-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Closed
Description
As it is now, the stat module follow symlinks instead of returning stat information of the link itself. For example, /etc/localtime is a symlink but stat reports (abbreviated output below):
$ hacking/test-module -m library/files/stat -a 'path=/etc/localtime'
PARSED OUTPUT
{
"changed": false,
"stat": {
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
Fixing the call from os.stat to os.lstat fixes the stat module so that it properly reports that the file is a symlink (note that islnk is now true):
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": true,
"isreg": false,
"issock": false,
"isuid": false,
I'm happy to submit a PR to fix the stat module, but wasn't sure if the module should accept an option to follow symlinks if so desired. I think the default should be to not follow links, but am happy to implement either way.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels