Hi John, Ata, John (US) wrote,
Hi all,
In using ftw/nftw, I’ve discovered a bug when using FTW_CHDIR and FTW_DEPTH. After changing the working directory to a subdirectory, nftw would process the contents fine. However, it would then try and process the directory itself while still in that directory and then switch back to the parent. This would result in an error (ENOENT). This patch will change working directories to the parent before processing the directory itself.
Thanks for the report. Are you able to provide a small test-case showing the issue?
best regards Waldemar
Hi Waldemar,
I'm enclosing a testcase. When run from an unpatched uclibc-ng system, we see:
Processing f2 in working dir /tmp/stest_dir/d1 Processing d1 in working dir /tmp/stest_dir/d1 Oops...relative path does not exist in current directory: No such file or directory Processing f1 in working dir /tmp/stest_dir Processing stest_dir in working dir /tmp/stest_dir Oops...relative path does not exist in current directory: No such file or directory
When run from a patched system, we see:
Processing f2 in working dir /tmp/stest_dir/d1 Processing d1 in working dir /tmp/stest_dir Processing f1 in working dir /tmp/stest_dir Processing stest_dir in working dir /tmp
Let me know if you need anything else...
Take care, ---- John Ata, CISSP Senior Principal Software Engineer Electronics Systems STOP Operating System Software Development
T 703-563-8115 | F 703-668-4359 | john.ata@baesystems.com http://www.baesystems.com/csp
-----Original Message----- From: Waldemar Brodkorb [mailto:wbx@uclibc-ng.org] Sent: Tuesday, October 18, 2016 12:17 PM To: Ata, John (US) john.ata@baesystems.com Cc: devel@uclibc-ng.org Subject: Re: [uclibc-ng-devel] PATCH] Fix ntfw when called with FTW_CHDIR and FTW_DEPTH to change directory back to the parent before processing the directory (after the contents have already been processed).
*** WARNING *** EXTERNAL EMAIL -- This message originates from outside our organization.
Hi John, Ata, John (US) wrote,
Hi all,
In using ftw/nftw, I’ve discovered a bug when using FTW_CHDIR and FTW_DEPTH. After changing the working directory to a subdirectory, nftw would process the contents fine. However, it would then try and process the directory itself while still in that directory and then switch back to the parent. This would result in an error (ENOENT). This patch will change working directories to the parent before processing the directory itself.
Thanks for the report. Are you able to provide a small test-case showing the issue?
best regards Waldemar