Skip Menu |

This queue is for tickets about the IPC-Run CPAN distribution.

Report information
The Basics
Id: 69239
Status: resolved
Priority: 0/
Queue: IPC-Run

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: perms 644 on output
Date: Sat, 02 Jul 2011 08:42:38 +1000
To: bug-IPC-Run [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
IPC::Run 0.89 creates it's output files only 644, which prevents a user giving group write permissions with umask. The program foo.pl below shows how perl's open() or the shell ">foo" output both follow the umask on output, giving group write perms, but IPC::Run does not. perlfunc.pod under sysopen() notes that 0644 is usually wrong, for this reason. Normally 0666 is right (or for something security related then 0600).
#!/usr/bin/perl -w use strict; use warnings; use IPC::Run; umask 0002 or die; print "umask is ",umask(),"\n"; unlink "/tmp/ipc-run.txt"; unlink "/tmp/system.txt"; unlink "/tmp/open.txt"; IPC::Run::run (['echo', 'hello'], '>', "/tmp/ipc-run.txt"); system "echo hello >/tmp/system.txt"; open my $fh, '>', '/tmp/open.txt' or die; close $fh; system("ls -l /tmp/ipc-run.txt /tmp/system.txt /tmp/open.txt");
I agree. This is an issue we're hard coding the open and I don't see a reason to do so. PERHAPS we should observe the umask and force off the execute bit if seen. https://github.com/toddr/IPC-Run/blob/master/lib/IPC/Run.pm#L1300 my $r = POSIX::open( $_[0], $_[1], 0644 );
On Wed Aug 22 10:00:29 2012, TODDR wrote: Show quoted text
> > PERHAPS we should observe the umask and force off the execute bit if > seen.
I would suggest 0666 which is usual for an ordinary execute-off file, and is what the shell does, if IPC::Run is to look vaguely like a shell command line. It's automatically reduced by the system according to umask. Perhaps in the future some sort of option could control the mode on each output file created, if there's room in the arg syntax for extras like that.
Ticket migrated to github as https://github.com/toddr/IPC-Run/issues/91