in reply to perldb.ini permission problem on Windows 11
sub is_safe_file { my $path = shift; stat($path) || return; # mysteriously vaporized my ( $dev, $ino, $mode, $nlink, $uid, $gid ) = stat(_); return 0 if $uid != 0 && $uid != $<; return 0 if $mode & 022; return 1; } ## end sub is_safe_file
Then I did some experimentation using a test script on the perldb.ini file and determined that (a) the $uid was zero, and (b) the file permission was 0100666.
After some research I discovered that the mode on Windows includes the file type, and that one is supposed to mask it with 07777 in order to get the permissions. The code in the perldb source is not doing that, otherwise the mode would be 0666.
What the test is looking for, though, is a file with 0644. I've tried everything I can in the Properties-Security tab to get that, and no joy. I also tried the tool that was suggested, though it wasn't any easier to understand than the Properties Security tab. Anyway, at this point I managed to get a file that is owned by my userid, and that has no permissions for anyone else -- not even System or Administrators.
Here's what ls -la tells me:
That looks right, yet when I do a stat on the file I still get 010066:ls -la perldb.ini -rw-r--r-- 1 jgpuckering 197615 140 Sep 18 11:44 perldb.ini
One thing that is clear is that the perldb test is flawed on Windows. At the very least, it should be masking the mode with 07777 to get rid of the file type.perl -MFile::stat -E "printf '%%07o', stat('perldb.ini')->mode" 0100666
But beyond that, I think there's something fundamentally wrong with this test. Due to the inherent differences between Windows file security and Unix file security, there seems to be no way -- or at least, no obvious or easy way -- for a user to set the file permissions in Windows so that the file will pass the test.
I suspect that testing file access in this fashion on Windows using stat() simply doesn't work. The test should either be written differently for Windows, or disabled for Windows.
Perhaps this has been fixed in a later release. As I mentioned, I'm running v5.31.1 of Strawberry perl, which is the latest release I can get. I've got a workaround, but this seems to me to be a bug that has broken perldb.ini support on Windows.
Should I report this as a perl bug? If so, how and where?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perldb.ini permission problem on Windows 11
by syphilis (Archbishop) on Sep 20, 2022 at 01:41 UTC | |
by PUCKERING (Sexton) on Sep 20, 2022 at 04:08 UTC | |
|
Re^2: perldb.ini permission problem on Windows 11
by afoken (Chancellor) on Sep 21, 2022 at 17:51 UTC | |
by Anonymous Monk on Sep 22, 2022 at 11:48 UTC | |
|
Re^2: perldb.ini permission problem on Windows 11
by NERDVANA (Priest) on Sep 21, 2022 at 07:38 UTC |