Re: [ANNOUNCE] util-linux v2.30-rc2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 31 May 2017, Assaf Gordon wrote:

> rename: exit codes                     ... FAILED (rename/exit_codes)

This is because stdout and stderr are mixed:

musl seems to behave like the patch below, while glibc always prints 
the "wrong" order.

--------------
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 502e888..edfc4e0 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -103,10 +103,13 @@ static int do_file(char *from, char *to, char *s, 
int verbose, int noact)
                return 0;
        else if (!noact && rename(s, newname) != 0) {
                warn(_("%s: rename to %s failed"), s, newname);
+               fflush(stderr);
                ret = 2;
        }
-       if (verbose && (noact || ret == 1))
+       if (verbose && (noact || ret == 1)) {
                printf("`%s' -> `%s'\n", s, newname);
+               fflush(stdout);
+       }
        free(newname);
        return ret;
 }
-------------

Not sure whether we should really use fflush() to define the order of 
error and non-error messages. We could also simply "fix" the the test 
script by not using "--verbose". or by using "stdbuf -o0 -e0 
rename ..."


cu,
Rudi
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux