Make will search in the catalogue of rules for a way to
update the target, and in case of finding the dependency
it will apply the rule without a need of specifying that
dependency.
The Makefile rule was too complex and these cases is better to just
move it to a script where will be eassier to use sed properly
and not looping over all the files 4 times.
The signal handlers were calling longjmp() but as the code was calling
non signal safe functions the behaviour was very unpredictable generating
segmentation faults and dead lock. This commit changes the signal handlers
to only set a variable that is checked in safe places where long loops
happen.
POSIX.1-2017 demands in Shell & Utilities under 'Commands in ed':
The e, E, f, r, and w commands shall take an optional file parameter,
separated from the command letter by one or more <blank> characters.
Ensure at least one <blank> character (as defined for the POSIX locale)
is present or error out.
Signed-off-by: Rene Kita <mail@rkta.de>
Fopen() and Popen() were open as read streams, but we were writing
in both cases. In the same way, the FILE pointer returned by popen()
was close with fclose() that can lead to file descriptor leaks and
zombie processes.
Discard() was reading stdin until a new line was found, but in
case of having an empty line in the input buffer then it didn't
make sense because we were just discarding the full next line.
The substitution must happen in all the parameters that contain
the replacement string, but the code was soing the substitution
only once and in the parameter with an exact match.
Also, the argument length was not updated correctly, assuming
that the final argument had the size read from stdin.
The free() was added in the wrong assumption that xargs was not
freeing the argument in the position replaced, but it actually
does it.
Also, removing the call to free() makes more general the function.
a simple test case:
printf ab3 | tr -c '[:alpha:]' '\n'
output should be ab<newline>, previously you would find just newlines.
Signed-off-by: noneofyourbusiness <noneofyourbusiness@danwin1210.de>
When the file name begins with ! then the addressed buffer content is
piped to the name of the file that is considered a command that is
executed in a shell.
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.