Date: Fri, 24 May 2019 13:57:26 +0200 From: Kamil Rytarowski <n...@gmx.com> Message-ID: <049cb255-b647-a241-7d41-4ec2a1151...@gmx.com>
| It prints now program name for the -f option and decodes properly text | string for read(2). | | =2E/truss -o /tmp/log.txt -f /usr/src/build.sh | | Part of log.txt: | | 8836 sh read(12, "#!/bin/sh\n#\n#\t$NetBSD: osrelease", 1016)=3D 0x3f8 | 8836 sh read(12, "O EVENT SHALL THE FOUNDATION OR ", 1016)=3D 0x3f8 | 8836 sh open("/usr/src/sys/conf/../sys/param.h"..., O_RDONLY)=3D 0x3 | 8836 sh dup2() =3D 0 | 8836 sh close(3) =3D 0 | 8836 sh read(0, "/", 1) =3D 0x1 | 8836 sh read(0, "*", 1) =3D 0x1 | 8836 sh read(0, "\t", 1) =3D 0x1 That's executing the read builtin command - that's the one place in sh where it has to read 1 byte at a time still, as it is reading stdin (which is obvious there from the read(0,...)) and it isn't allowed to read more than one line, so that whatever follows is available for whatever is to read stdin next. I'm not sure exactly where that comes from however, build.sh only uses read in one place that I can see ... if [ -n "${BUILDINFO}" ]; then printf "%b\n" "${BUILDINFO}" | \ while read -r line ; do [ -s "${line}" ] && continue statusmsg2 "BUILDINFO:" "${line}" done fi which doesn't have it reading param.h I don't think... So, is that from something that make runs? There are often better ways to do things that while read loops (but not always). kre