Open nohup.out write-only instead of not specifying the access permissions
instead of getting undefined behavior (which probably results in stdout
not being writable).
The commands may produce output themselves, so this is required to
ensure that our -print output is actually written before a command's
output, and also that we don't end up with partially written lines
due to stdout buffering intermixed with the output of other commands.
Other implementations of find(1) do the same.
Previously, there was an off-by-one error when determining whether
to print a strings, so when the string was exactly the minimum
length, it was not printed.
This fixes a bug with an x264 configure test, which expects to find
a string of length 4 (BIGE/EBIG) to detect system endianness.
After join() is called for the first time, s.str is left pointing
to a string that was just freed. Upon the second call to join(),
it is freed again at the start of the function.
Since the string is reset on every function call, there is no reason
for it to be static, so just replace the initial free with assignment
to NULL.
I have noticed this issue while I was trying to package sbase-box. Since
sbase-box was in the PHONY target, running sbase-box-install caused it to
be rebuilt when it was unnecessary. This also caused options passed to make
to be lost (such as LDFLAGS).
We know that r->pathlen < sizeof(r->path) since r->path is
nul-terminated, so we can safely add a '/' here. If there is no
space left over for the rest of the path and nul-terminator, this
will be caught by the subsequent estrlcpy.
path is not fixed up on exit from recursive step, this leads to
incorrect paths in du's output.
% find D
D
D/E
D/E/F
D/E/F/a2
D/E/F/b2
D/E/a1
D/E/b1
D/a
D/b
% du D
4 D/E/F
8 D/E
12 D
% ~/sbase/du D
4 D/E/F/b2
8 D/E/b1
12 D
The stack is used for two purposes: storing operators for the
shunting yard algorithm, and storing primitives when arranging the
operators into a tree. The number of operators is bounded by the
number of arguments, since we only insert at most one extra operator
per primitive. However, the number of primitives may be as high as
argc + 1, since -print may have been added implicitly.
This can triggered with an empty expression, `find .`, since in
this case argc is 0, but we still try to store -print in the stack.
Detected with musl's WIP allocator, mallocng-draft.
All install(1) implementations I'm aware of don't try to replicate
the source file node like this. Additionally, this reportedly breaks
some scripts that use install(1) in a pipeline.
These flags are non-POSIX and not useful since the mode of symlinks
is not used for anything.
This prevents a failure when a dangling symlink is encountered
during a recursive chmod.
ISO C does not require that main() have an explicit return value
(if the end of the main function is reached, it is as if it returned
0). However, when built as sbase-box, the main function is turned
into getconf_main, which does not have the same special treatment.
Although mknod is not a POSIX tool, it is widely available on nearly
all UNIX-like systems. It also can be implemented portably apart
from use of the makedev macros, which is already a requirement of
a couple other tools in sbase.
While we're at it, fix a few bugs:
- Include sys/sysmacros.h if makedev was not defined by sys/types.h
- The default mode should respect the user's umask, rather than
assuming it is 022.
- Clear the umask when -m is specified explicitly so that nodes can
be created with permissions wider than the user's umask.
- Utilize parsemode from libutil to support symbolic mode strings.
Fix "new sentence, new line" warnings throughout so that formatters
can produce correct spacing between sentences.
join.1
Remove unnecessary Ns macros. These are not necessary for delimeters,
which get special treatment.
xinstall.1
Fix date in manual. The contents were last modified on 2016-12-03,
so use that instead of the invalid date.
grep.1
Fix escape sequence for `\<` and `\>`.
ed.1
Remove spurious `\\n` escape for the null-command.