Also, since parsemode exits on failure, don't bother checking return
value in xinstall (this would never trigger anyway because mode_t can be
unsigned).
The %b case was using fputs after unescape to print the argument, which
meant that it could not handle nul bytes. Instead, store the length
returned from unescape and use fwrite to properly handle them.
Laslo: Fix some things pointed out by mandoc -Tlint:
1) replace empty lines with .Pp, we want to start a new
paragraph
2) Add a comma before the second item in SEE ALSO
3) Place SEE ALSO before STANDARDS, as is the convention
4) Update the man-date
By stripping backslashes this code caused a number of bugs.
'\<digit>' expressions caused literal <digit>s to be subbed-in,
'\&' was treated identically to '&', and other escaped characters
added garbage to the string.
regexec(3) happily matches /^$/ against the text of line
zero (the null string), causing an error.
Also update email address for Wolfgang Corcoran-Mathe
See his description below. Thanks Michael!
---
A bug was introduced in bc4c293fe5 causing the
range length for the next set to be used instead of the first one. This causes
issues when choosing the replacement rune when the ranges are of different
lengths.
Current behavior:
$ echo 1234 | tr 'a-f1-4' '1-6a-d'
56ab
Correct behavior:
$ echo 1234 | tr 'a-f1-4' '1-6a-d'
abcd
This also fixes range expressions in the form [a-z], which get encoded as four
ranges '[', 'a'..'z', ']', causing all a-z characters to get mapped to ']'. This
form is occasionally used in shell scripts, including the syscalltbl.sh script
used to build linux.
---
Previously, this would not work properly and not be let through the
sanity check.
This is a dirty hack until the next iteration where I'll clean up the
data structures and make this saner.
If you look at GNU coreutils, they do not support the mappings
$ echo "1234abc" | tr "[:alnum:]" "[:upper:]"
$ echo "ABCabc" | tr -c "[:upper:]" "[l*]"
to only give a few examples. This commit broadens the scope of tr(1)
as far as humanly possible to map between classes and non-classes,
making tr a usable tool and actually fulfilling user expectations.
Posix really is of no help here as it still kind of assumes the
fixed ASCII table instead of complex Unicode code points or even
Grapheme clusters.
Okay, it took me a while and another look at the Posix spec to see that
I have been dealing with squeezing in a way too complicated way.
What just needed to be done is before doing the final write to deploy
the squeeze-check. We actually do not need this atomically complicated
squeeze check in every single edge-case. Now it should work properly.
Given:
static int marks['z' - 'a'];
marks[c];
In this case c is the character read and index is out of bounds. We
need marks[c - 'a']
While playing around with optimization settings gcc caught caught this.
Also fix one check for c, change from isalpha to islower.
-emg
From 2cc36818283e9068576c1042690c016a81b709a3 Mon Sep 17 00:00:00 2001
From: Evan Gates <evan.gates@gmail.com>
Date: Fri, 15 Jul 2016 09:52:39 -0700
Subject: [PATCH] fix marks indexing
This allows users to touch files they have write access to, but aren't the
owner.
Also, remove utime.h include (not necessary since
4132561c17), and make sure to check the return
value of localtime (potentially preventing a NULL pointer derefence).
Currently, if the caller has a umask of 002 or 000, the file gets created as 644
anyway.
Also, add O_WRONLY to the open call, since POSIX says that "Applications shall
specify exactly one of the first five values (file access modes) below in the
value of oflag".
This is required in order for autoconf's AC_PROG_INSTALL to use the sbase
install. Otherwise it will fall back to the slow and sucky install-sh script
from automake.
Currently, if you specify -t x, then s is advanced once in the switch statement
to determine the length, and then once again in the for loop, resulting in a
read past the end of the argument.
Also, use sizeof(int) when no length is specified, as specified by POSIX.
I'm not sure if there are other implications of this or not, but
the issue is that columns() uses len to store the allocated buffer
size, but linecmp() compares up to len bytes. If those trailing
bytes do not match, the line is considered not matching, even though
the relevant parts of the buffer do match.
To resolve this, also keep track of column capacity. Additionally,
since there is no reason to keep the existing data when resizing,
just use free and emalloc rather than erealloc.
The simplest case I could reduce it to is this:
if [ "$(printf '%s\n' a a xxb xxc | ./sort -u)" = "$(printf '%s\n' a xxb xxc)" ] ; then
echo pass
else
echo fail
fi
- After first iteration, set first to 0 instead of !first.
- If Hflag || Lflag, then mkent used stat instead of lstat, so the
entity cannot be a symlink.
- Print path prefix along with directory name.
- In the 'if (Rflag)' block, just use 1 instead of Rflag.
This reverts commit bb83eade39.
This commit causes the loop through dents at the end of main to
continue past the end of the dents array, causing a crash when
called with multiple directory arguments.
Previously, it printed lines that didn't match some pattern. Instead,
it should print lines that don't match *any* pattern.
Test case:
out=$(echo foo | ./grep -v -e foo -e bar)
if [ "$?" = 1 ] && [ -z "$out" ] ; then
echo pass
else
echo fail
fi