More Web Proxy on the site http://driver.im/
GNU bug report logs -
#24659
'mkdir' procedure is neither thread-safe nor safe (2.0.12)
Previous Next
Reported by: ludo <at> gnu.org (Ludovic Courtès)
Date: Mon, 10 Oct 2016 16:41:02 UTC
Severity: important
Fixed in version 2.0.13
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24659 in the body.
You can then email your comments to 24659 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#24659
; Package
guile
.
(Mon, 10 Oct 2016 16:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
ludo <at> gnu.org (Ludovic Courtès)
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Mon, 10 Oct 2016 16:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello!
When the optional ‘mode’ argument to the ‘mkdir’ procedure is omitted,
umask(2) is used to find out what the current mask is and to compute the
mode argument to mkdir(2):
--8<---------------cut here---------------start------------->8---
if (SCM_UNBNDP (mode))
{
mask = umask (0);
umask (mask);
STRING_SYSCALL (path, c_path, rv = mkdir (c_path, 0777 ^ mask));
}
--8<---------------cut here---------------end--------------->8---
The problem is that this changes the process’ umask globally for a short
duration, during which other threads will get 0 as the mask…
Furthermore, AFAICS, the above logic is redundant with what the kernel
does anyway. That is, in a single-threaded program,
mask = umask (0);
umask (mask);
mkdir (file, 0777 ^ mask);
is equivalent to:
mkdir (file, 0777);
Am I right that we should just remove these two ‘umask’ calls?
Ludo’.
PS: This code has been there since 1996 or earlier.
Information forwarded
to
bug-guile <at> gnu.org
:
bug#24659
; Package
guile
.
(Mon, 10 Oct 2016 18:27:01 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, Oct 10, 2016 at 06:39:47PM +0200, Ludovic Courtès wrote:
> Hello!
[...]
> Furthermore, AFAICS, the above logic is redundant with what the kernel
> does anyway. That is, in a single-threaded program,
>
> mask = umask (0);
> umask (mask);
> mkdir (file, 0777 ^ mask);
>
> is equivalent to:
>
> mkdir (file, 0777);
>
> Am I right that we should just remove these two ‘umask’ calls?
According to umask(2), yes, you are right. Unless someone has been
trying to work around some platform-specific bug/idiosyncracy.
Regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlf73SEACgkQBcgs9XrR2kZehwCfQ+P2CMZt8doHe2tKi0u1Yc7f
RU0An0WY1oEq/b3vu/X1rNWjTP7ZxUsY
=7Jhs
-----END PGP SIGNATURE-----
Severity set to 'important' from 'normal'
Request was from
ludo <at> gnu.org (Ludovic Courtès)
to
control <at> debbugs.gnu.org
.
(Tue, 11 Oct 2016 07:57:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-guile <at> gnu.org
:
bug#24659
; Package
guile
.
(Tue, 11 Oct 2016 09:14:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 24659 <at> debbugs.gnu.org (full text, mbox):
Hi,
<tomas <at> tuxteam.de> skribis:
> On Mon, Oct 10, 2016 at 06:39:47PM +0200, Ludovic Courtès wrote:
>> Hello!
>
> [...]
>
>> Furthermore, AFAICS, the above logic is redundant with what the kernel
>> does anyway. That is, in a single-threaded program,
>>
>> mask = umask (0);
>> umask (mask);
>> mkdir (file, 0777 ^ mask);
>>
>> is equivalent to:
>>
>> mkdir (file, 0777);
>>
>> Am I right that we should just remove these two ‘umask’ calls?
>
> According to umask(2), yes, you are right. Unless someone has been
> trying to work around some platform-specific bug/idiosyncracy.
I don’t think there was ever a good reason for this.
Fixed in 245608911698adb3472803856019bdd5670b6614.
Thanks for your feedback,
Ludo’.
bug marked as fixed in version 2.0.13, send any further explanations to
24659 <at> debbugs.gnu.org and ludo <at> gnu.org (Ludovic Courtès)
Request was from
ludo <at> gnu.org (Ludovic Courtès)
to
control <at> debbugs.gnu.org
.
(Tue, 11 Oct 2016 09:15:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 08 Nov 2016 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 75 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.