[Bug 1650041] Perl 5.28.0 in-place edit broken

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

 



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

Petr Pisar <ppisar@xxxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED



--- Comment #1 from Petr Pisar <ppisar@xxxxxxxxxx> ---
This looks like a glitch when more secure file replacement was added into perl
code.

$ cat test 
1
$ strace perl -i -e '$/=undef; $a=<>; $a=~s/1/2/; print $a' test

openat(AT_FDCWD, "test", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, TCGETS, 0x7ffeb193f510)        = -1 ENOTTY (Inappropriate ioctl for
device)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0664, st_size=2, ...}) = 0
umask(0177)                             = 002
getpid()                                = 1192
openat(AT_FDCWD, "XXH6qplJ", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4
fcntl(4, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
umask(002)                              = 0177
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
ioctl(4, TCGETS, 0x7ffeb193f5a0)        = -1 ENOTTY (Inappropriate ioctl for
device)
lseek(4, 0, SEEK_CUR)                   = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
getpid()                                = 1192
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
fstat(5, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=180, ...}) = 0
brk(NULL)                               = 0x55f03b859000
brk(0x55f03b87b000)                     = 0x55f03b87b000
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
fchmod(4, 0100664)                      = 0
fstat(3, {st_mode=S_IFREG|0664, st_size=2, ...}) = 0
read(3, "1\n", 8192)                    = 2
read(3, "", 8192)                       = 0
[...]
write(4, "2\n", 2)                      = 2
close(3)                                = 0
getpid()                                = 1192
close(4)                                = 0
unlinkat(5, "XXH6qplJ", 0)              = 0
[...]
close(5)                                = 0
exit_group(0)                           = ?


It unlinks the output file instead of renaming it to the original input file
name as it happens when editing per-line:

$ strace perl -i -p -e 's/1/2/' test
[...]
openat(AT_FDCWD, "test", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, TCGETS, 0x7fff259cc550)        = -1 ENOTTY (Inappropriate ioctl for
device)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0664, st_size=2, ...}) = 0
umask(0177)                             = 002
getpid()                                = 1196
openat(AT_FDCWD, "XXJAnFeW", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4
fcntl(4, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
umask(002)                              = 0177
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
ioctl(4, TCGETS, 0x7fff259cc5e0)        = -1 ENOTTY (Inappropriate ioctl for
device)
lseek(4, 0, SEEK_CUR)                   = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
getpid()                                = 1196
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
fstat(5, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=180, ...}) = 0
brk(NULL)                               = 0x5559d5c60000
brk(0x5559d5c82000)                     = 0x5559d5c82000
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
fchmod(4, 0100664)                      = 0
read(3, "1\n", 8192)                    = 2
read(3, "", 8192)                       = 0
write(4, "2\n", 2)                      = 2
close(4)                                = 0
getpid()                                = 1196
renameat(5, "XXJAnFeW", 5, "test")      = 0
close(5)                                = 0
close(3)                                = 0
[...]
exit_group(0)                           = ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
perl-devel mailing list -- perl-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to perl-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/perl-devel@xxxxxxxxxxxxxxxxxxxxxxx




[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