From POSIX:
in the POSIX locale the following diagnostic message shall be written:
"cmp: EOF on %s%s\n", <name of shorter file>, <additional info>
Amended by mcf: kept weprintf for consistency with other diagnostic
messages, but dropped the doubled prefix.
The POSIX spec gives many options on how to handle this case, but it
also states that cp (and mv) should continue with remaining operands
regardless. We used to exit immediately, which violates the spec.
This change makes cp/mv not exit immediately in this case and
also won't cause the return value to be non-zero.
From `man 1p cp`:
If source_file references the same file as dest_file, cp may write
a diagnostic message to standard error; it shall do nothing more
with source_file and shall go on to any remaining files.
When ibs is smaller than obs, checking the block count in the outer
loop is not sufficient; we need to break out of the inner read loop
once we've read the specified number of blocks.
Thanks to phoebos for reporting this issue.
ipos is always ahead of opos, so the left side of this condition
was never true. This only mattered when we get short writes, since
on EOF we always have less than a full output block, so it takes
only one normal write.
The license text matches (and has always matched) what is known as
the MIT license[0]. The MIT/X Consortium license, also called the
X11 license, is slightly different and has an additional clause
prohibiting various uses of the X Consortium name.
[0] https://opensource.org/licenses/MIT
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.