Package: liblua5.1-filesystem0
Version: 1.4.1-1
Severity: normal
Hi!
Appears that lfs.mkdir sets umask to 0 before creating directory (it
explicitly sets permissions to 775 regardless any umask value), but it doesn't
reset it back if creating directory fails.
Below I cite src/lfs.c:
========================================================================
static int make_dir (lua_State *L) {
const char *path = luaL_checkstring (L, 1);
int fail;
#ifdef _WIN32
int oldmask = umask (0);
fail = _mkdir (path);
#else
mode_t oldmask = umask( (mode_t)0 );
fail = mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH );
#endif
if (fail) {
lua_pushnil (L);
lua_pushfstring (L, "%s", strerror(errno));
return 2;
}
umask (oldmask);
lua_pushboolean (L, 1);
return 1;
}
========================================================================
Note 'umask (oldmask)' isn't reached if fail is true. The pretty obvious
solution is to move 'umask (oldmask)' before 'if (fail)', but I wonder why
lfs.mkdir doesn't respect umask at all? May be it'd be better to remove all
calls to umask?
BTW, this bug is present in 1.4.2-2 from sid also, and affects prosody (see bug
#561704).
-- System Information:
Debian Release: 5.0.3
APT prefers stable
APT policy: (990, 'stable')
Architecture: i386 (x86_64)
Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.CP1251, LC_CTYPE=ru_RU.CP1251 (charmap=CP1251)
Shell: /bin/sh linked to /bin/bash
Versions of packages liblua5.1-filesystem0 depends on:
ii libc6 2.7-18 GNU C Library: Shared libraries
liblua5.1-filesystem0 recommends no packages.
liblua5.1-filesystem0 suggests no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]