(reported downstream https://bugs.gentoo.org/show_bug.cgi?id=527848) According to posix, the effect of the "-n" argument to echo is implementation-dependent. So a few shells, like the heavily patched variant of dash that Gentoo ships, do strange things with it - e.g. "echo -n foo" outputs "-n foo". If such a shell is used as /bin/sh, the "echo -n mem /sys/power/state" calls in pm-utils will fail. And that "-n" is not needed even when using bash: when writing to /sys/power/state, or almost anything else in /sys, the terminal newline doesn't make a difference.
Created attachment 117432 [details] [review] proposed patch
Rather than changing all these, consider adding a shell function as follows: echo() { local fmt='%s\n' [ "$1" = "-n" ] && { fmt='%s'; shift; } printf "$fmt" "$*" } You can then redefine the existing log() function (line 90): log() { is_set "$LOGGING" || return 0; echo $* } This will (a) work on all platforms where log() now works (b) support use of "echo -n" in the code in case future contributors should introduce any.
Created attachment 122011 [details] patch based on review of patch 117432 taken from running pm-functions
pm-utils hasn't been touched in eight years, none of this is likely to get addressed. Closing bugs and disabling the bz product.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.