[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #25538] excluded files are still stat()ed
From: |
Kevin Pulo |
Subject: |
[bug #25538] excluded files are still stat()ed |
Date: |
Tue, 10 Feb 2009 04:24:38 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.14) Gecko/20080421 Firefox/2.0.0.14 |
URL:
<http://savannah.gnu.org/bugs/?25538>
Summary: excluded files are still stat()ed
Project: GNU Core Utilities
Submitted by: devkev
Submitted on: Tue 10 Feb 2009 04:24:35 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
My problem is that files I have excluded from du using -X or --exclude still
have stat() run on them. In particular, this is a problem when trying to
exclude some fuse filesystems on Linux, eg. sshfs and encfs, which deny all
access to other users (including root).
For example:
address@hidden:~# du -axk /home/kev/mnt/sf
du: cannot access `/home/kev/mnt/sf/home': Permission denied
4 /home/kev/mnt/sf
address@hidden:~# du -axk --exclude=/home/kev/mnt/sf/home /home/kev/mnt/sf
du: cannot access `/home/kev/mnt/sf/home': Permission denied
4 /home/kev/mnt/sf
address@hidden:~# echo $?
1
address@hidden:~#
The non-zero exit status is particularly troubling, since it means I cannot
chain other commands after du using '&&' whenever it's operating on a tree
that has these sorts of fuse fs's in it.
The only workaround at the moment is to exclude the parent directory, eg.
--exclude=~kev/mnt/sf in the example above. This unfortunately means that
everything else in that directory is also excluded.
address@hidden:~# du -axk --exclude=/home/kev/mnt/sf /home/kev/mnt/sf
address@hidden:~# echo $?
0
address@hidden:~#
Having looked at the code, I'm not sure how this would best be fixed. The
list of excluded files is only used in process_file(), which is too late. I
presume that the stat() is happening inside fts_read(), which populates
end->fts_statp with the results of the stat() call. I suppose that extending
fts_read() to also respect the exclusion list would be fairly invasive.
Alternatively, the EPERM could persist during the fts_read(), but then be
somehow "forgotten about" later for excluded files, allowing the exit status
to return to being 0 (assuming no other genuine errors).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?25538>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #25538] excluded files are still stat()ed,
Kevin Pulo <=