[Bug 204093] perl -i resets file ACLs and EAs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug.


https://bugzilla.redhat.com/show_bug.cgi?id=204093


Jan Pazdziora <jpazdziora@xxxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |Reopened
             Status|CLOSED                      |ASSIGNED
         Resolution|NOTABUG                     |




--- Comment #5 from Jan Pazdziora <jpazdziora@xxxxxxxxxx>  2008-11-28 08:59:16 EDT ---
The reasoning in comment #4 is not correct. The perlrun man page does not
explicitly state that file permisions are preserved, yet they are:

$ echo ppp > a
$ ls -l a
-rw-rw-r-- 1 adelton adelton 4 2008-11-28 14:52 a
$ chmod 600 a
$ ls -l a
-rw------- 1 adelton adelton 4 2008-11-28 14:52 a
$ perl -i -pe 's!ppp!qqq!' a
$ ls -l a
-rw------- 1 adelton adelton 4 2008-11-28 14:52 a
$

and strace shows that perl does an explicit chmod:

open("a", O_RDONLY)                     = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff2b869470) = -1 ENOTTY
(Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0600, st_size=4, ...}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
unlink("a")                             = 0
open("a", O_WRONLY|O_CREAT|O_EXCL, 0666) = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff2b869470) = -1 ENOTTY
(Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR)                   = 0
fstat(4, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fstat(4, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
fchmod(4, 0100600)                      = 0
read(3, "ppp\n", 4096)                  = 4
read(3, "", 4096)                       = 0
write(4, "qqq\n", 4)                    = 4
close(4)                                = 0
close(3)                                = 0
exit_group(0)                           = ?

So perl goes the extra mile to leave the resulting file in a state as close to
the original. It should do so with ACLs and EAs as well.

Reopening.

-- 
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
Fedora-perl-devel-list mailing list
Fedora-perl-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-perl-devel-list

[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux