GNU bug report logs - #35713
/dev/stdin problem in cp on Solaris

Previous Next

Package: coreutils;

Reported by: jakub.kulik <at> oracle.com

Date: Mon, 13 May 2019 14:21:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#35713: closed (/dev/stdin problem in cp on Solaris)
Date: Sun, 02 Jun 2019 06:01:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 1 Jun 2019 23:00:46 -0700
with message-id <b1e8d369-5ffe-4b00-7e91-e16604f6a306 <at> cs.ucla.edu>
and subject line Re: bug#35713: /dev/stdin problem in cp on Solaris
has caused the debbugs.gnu.org bug report #35713,
regarding /dev/stdin problem in cp on Solaris
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
35713: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35713
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: jakub.kulik <at> oracle.com
To: bug-coreutils <at> gnu.org
Subject: /dev/stdin problem in cp on Solaris
Date: Mon, 13 May 2019 12:24:17 +0200
[Message part 3 (text/plain, inline)]
Hi,

We found out that the following simple command fails on Solaris with:

 cat srcfile.txt | /usr/gnu/bin/cp /dev/stdin dstfile.txt
 cp: skipping file '/dev/stdin', as it was replaced while being copied

I found that problem is with SAME_INODE macro. It accepts two 
structures, one from stat and another from fstat function. On Solaris, 
each of these can return a different thing. While stat returns 
information about the /dev/fd/0 file itself (linked by /dev/stdin), 
fstat knows much more from the file descriptor and returns info about 
the pipe that is being used. That results in SAME_INODE failing.

This happens in both Coreutils 8.30 and 8.31 (both intel and sparc) but 
it looks like it was seen first in 8.16.

The easiest fix to this issue I came up with is to disable SAME_INODE 
validation for special devices and pipes (as they won't be moved 
anyway). Patch is attached as well as small program that can show stat 
and fstat differences on Solaris.

Thanks
Jakub

[copy.c.patch (text/x-patch, attachment)]
[stdin_test.c (text/x-csrc, attachment)]
[Message part 6 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: jakub.kulik <at> oracle.com
Cc: 35713-done <at> debbugs.gnu.org,
 Pádraig Brady <P <at> draigBrady.com>
Subject: Re: bug#35713: /dev/stdin problem in cp on Solaris
Date: Sat, 1 Jun 2019 23:00:46 -0700
jakub.kulik <at> oracle.com wrote:

> I tested the patch on both intel and sparc platform and all seems to work 
> without any problem.
> 
> So I guess this can be closed as solved.

Thanks for checking; closing.


This bug report was last modified 5 years and 354 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.