Skip Menu |

This queue is for tickets about the App-Daemon CPAN distribution.

Report information
The Basics
Id: 75219
Status: resolved
Priority: 0/
Queue: App-Daemon

People
Owner: Nobody in particular
Requestors: david.serrano [...] qindel.com
Cc:
AdminCc:

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



CC: David Serrano <david.serrano [...] qindel.com>
Subject: App::Daemon sets too restrictive umask
Date: Wed, 22 Feb 2012 17:09:59 +0100
To: bug-App-Daemon [...] rt.cpan.org
From: David Serrano <david.serrano [...] qindel.com>
Currently the function detach sets the process umask to 0133 so that "newly created files have rw-r--r-- permissions by default" (sic). This precludes the process from creating readily usable directories: $ perl use warnings; use strict; use App::Daemon 'daemonize'; daemonize; mkdir '/tmp/foobar'; __END__ $ ls -ld /tmp/foobar drw-r--r-- 2 hue hue 4096 20120222:170458+0100 /tmp/foobar/ $ cd /tmp/foobar bash: cd: /tmp/foobar: Permission denied $ _ By manually resetting the process' umask, all is well again: $ perl use warnings; use strict; use App::Daemon 'daemonize'; daemonize; umask 0022; mkdir '/tmp/foobar'; __END__ $ ls -ld /tmp/foobar drwxr-xr-x 2 hue hue 4096 20120222:170820+0100 /tmp/foobar/ $ cd /tmp/foobar $ _ This happens with App::Daemon 0.13, although I can see that 0.14 is affected as well by browsing the code at cpan.org. -- David Serrano GnuPG id: 280A01F9 - GRAVITY SUCKS! Legal boilerplate: **AVISO LEGAL** Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si no es usted el destinatario indicado, queda notificado que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción. -- Sent from my employer's Dell Vostro 3500
Download signature.asc
application/pgp-signature 836b

Message body not shown because it is not plain text.

On Wed Feb 22 11:10:18 2012, david.serrano@qindel.com wrote: Show quoted text
> Currently the function detach sets the process umask to 0133 so that > "newly > created files have rw-r--r-- permissions by default" (sic).
Note also that both perl "open" and C "fopen" request permissions 0666 for new files, so, in practice, both umask 0133 and umask 0022 create files with the same permissions (0644).
Hmm, interesting, I thought I had gotten rid of the umask in [rt #69561], but seems that I've fixed the pidfile permission without actually removing the umask call. So, according to http://en.wikipedia.org/wiki/Daemon_%28computing%29 which says "Changing the umask to 0 to allow open(), creat(), et al. operating system calls to provide their own permission masks and not to depend on the umask of the caller" I've changed the code to set the umask to 0: https://github.com/mschilli/app- daemon/commit/30deb73d86ad789ac820def113c403b48bec4a23 Looks good?