commit 40b289d73058601f96681c0e1048fce46c1751b1 from: Stefan Sperling date: Sat Sep 07 10:05:27 2019 UTC make 'got status' ignore inaccessible directories (reported by semarie) commit - 00f36e4705c823c9a2b0c558da9601d8da340d28 commit + 40b289d73058601f96681c0e1048fce46c1751b1 blob - 696ab23bd6d6225884a016c70864988c476f669f blob + 05c0896c505ce7c7462de2f06c6387e3169eb110 --- lib/fileindex.c +++ lib/fileindex.c @@ -926,6 +926,10 @@ walk_dir(struct got_pathlist_entry **next, struct got_ subdir = opendir(subdirpath); if (subdir == NULL) { + if (errno == EACCES) { + *next = TAILQ_NEXT(dle, entry); + return NULL; + } err = got_error_from_errno2("opendir", subdirpath); free(subpath); free(subdirpath); blob - b6130cbd359e573de7f6dc6be70e481d25764d33 blob + 1c38979ba097d0b6e400aac0aedaff2eff8228f8 --- lib/worktree.c +++ lib/worktree.c @@ -2451,7 +2451,7 @@ add_ignores(struct got_pathlist_head *ignores, const c ignoresfile = fopen(ignorespath, "r"); if (ignoresfile == NULL) { - if (errno != ENOENT) + if (errno != ENOENT && errno != EACCES) err = got_error_from_errno2("fopen", ignorespath); } else @@ -2541,7 +2541,7 @@ worktree_status(struct got_worktree *worktree, const c workdir = opendir(ondisk_path); if (workdir == NULL) { - if (errno != ENOTDIR && errno != ENOENT) + if (errno != ENOTDIR && errno != ENOENT && errno != EACCES) err = got_error_from_errno2("opendir", ondisk_path); else err = report_single_file_status(path, ondisk_path, blob - 99766ac88326608f2b27f3b5c8415b095b11073c blob + 5fde224adeff7a5c44b9167d6ceb971c1493e503 --- regress/cmdline/status.sh +++ regress/cmdline/status.sh @@ -33,6 +33,7 @@ function test_status_basic { touch $testroot/wt/beta echo "new file" > $testroot/wt/new (cd $testroot/wt && got add new >/dev/null) + mkdir -m 0000 $testroot/wt/bar echo 'M alpha' > $testroot/stdout.expected echo 'D beta' >> $testroot/stdout.expected @@ -47,6 +48,8 @@ function test_status_basic { if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout fi + chmod 700 $testroot/wt/bar + rmdir $testroot/wt/bar test_done "$testroot" "$ret" }