diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-03-02 13:13:19 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-03-02 13:13:19 +0100 |
commit | ceefac3e911b84c8aa8d215a3f7ec651aaeb4800 (patch) | |
tree | 0de146125f279e5478d70f22a5ad6e8726218781 /README | |
parent | f0e0326248e3a8c148eea64f77a5a1f84cf8d80b (diff) |
README: workaround empty fields with *BSD xargs -0
Workaround it by setting the empty "middle" fields to some value. The last
field can be empty.
Some feeds were incorrectly using the wrong base URL if the `baseurl` field was
empty but the encoding field was set. So it incorrectly used the encoding field
instead.
Only now noticed some feeds were failing because the baseURL is validated since
commit f305b032bc19b4e81c0dd6c0398370028ea910ca and returning a non-zero exit
status.
This doesn't happen with GNU xargs, busybox or toybox xargs.
Affected (atleast): OpenBSD, NetBSD, FreeBSD and DragonFlyBSD xargs which share
similar code.
Simple way to reproduce the difference:
printf 'a\0\0c\0' | xargs -0 echo
Prints "a c" on *BSD.
Prints "a c" on GNU xargs (and some other implementations).
Diffstat (limited to 'README')
-rw-r--r-- | README | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -650,7 +650,14 @@ sfeed_update_xargs shellscript: # feed(name, feedurl, basesiteurl, encoding) feed() { - printf '%s\0%s\0%s\0%s\0%s\0%s\0' "${config}" "${sfeedtmpdir}" "$1" "$2" "$3" "$4" + # workaround: *BSD xargs doesn't handle empty fields in the middle. + name="${1:-$$}" + feedurl="${2:-http://}" + basesiteurl="${3:-${feedurl}}" + encoding="$4" + + printf '%s\0%s\0%s\0%s\0%s\0%s\0' "${config}" "${sfeedtmpdir}" \ + "${name}" "${feedurl}" "${basesiteurl}" "${encoding}" } # fetch feeds and store in temporary directory. |