|
5 | 5 | # spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW |
6 | 6 | # spell-checker:ignore baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) greadlink gsed multihardlink texinfo CARGOFLAGS |
7 | 7 | # spell-checker:ignore openat TOCTOU CFLAGS tmpfs gnproc |
| 8 | +# spell-checker:ignore hfsplus casefold chattr dirp |
8 | 9 |
|
9 | 10 | set -e |
10 | 11 |
|
@@ -358,17 +359,13 @@ test \$n_stat1 -ge \$n_stat2 \\' tests/ls/stat-free-color.sh |
358 | 359 | # * the test says "maybe we should not fail when no context available" |
359 | 360 | "${SED}" -i -e "s|returns_ 1||g" tests/cp/no-ctx.sh |
360 | 361 |
|
361 | | -# The rm-readdir-fail.sh test hooks readdir() but uutils rm uses nix library which calls readdir64_r(). |
362 | | -# readdir64_r has a different signature: int readdir64_r(DIR*, struct dirent64*, struct dirent64**) |
363 | | -"${SED}" -i \ |
364 | | - -e 's/struct dirent \*readdir (DIR \*dirp)/int readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)/' \ |
365 | | - -e 's/struct dirent \*(\*real_readdir)(DIR \*dirp)/int (*real_func)(DIR *, struct dirent64 *, struct dirent64 **)/' \ |
366 | | - -e 's/real_readdir/real_func/g' \ |
367 | | - -e 's/dlsym (RTLD_NEXT, "readdir")/dlsym(RTLD_NEXT, "readdir64_r")/' \ |
368 | | - -e 's/struct dirent\* d;/int ret;/' \ |
369 | | - -e 's/! (d = real_func (dirp))/(ret = real_func(dirp, entry, result)) != 0 || !*result/' \ |
370 | | - -e 's/d->d_name/entry->d_name/g' \ |
371 | | - -e 's/d->d_namlen/entry->d_namlen/g' \ |
372 | | - -e 's/return d;/return 0;/' \ |
373 | | - -e 's/return NULL;/*result = NULL; return EIO;/' \ |
374 | | - tests/rm/rm-readdir-fail.sh |
| 362 | +# uutils rm uses nix which calls readdir64_r, so add a wrapper that delegates to the readdir hook |
| 363 | +"${SED}" -i '/^struct dirent \*readdir/i\ |
| 364 | +int readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result) {\ |
| 365 | + struct dirent *d = readdir(dirp);\ |
| 366 | + if (!d) { *result = NULL; return errno ? EIO : 0; }\ |
| 367 | + memcpy(entry, d, sizeof(*d));\ |
| 368 | + *result = entry;\ |
| 369 | + return 0;\ |
| 370 | +} |
| 371 | +' tests/rm/rm-readdir-fail.sh |
0 commit comments