summaryrefslogtreecommitdiff
path: root/core/sbase/patch
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-07-09 09:24:10 -0700
committerMichael Forney <mforney@mforney.org>2016-07-09 09:24:10 -0700
commit89246ef0df580ef992a2726e8873105cfe7d775b (patch)
treeef2b260cd2133427e6e0b936fa55a40b134fbc42 /core/sbase/patch
parent289cd1337a556044bbd0ca7a258cb520a7c51c9c (diff)
sbase: Patches were applied upstream
Diffstat (limited to 'core/sbase/patch')
-rw-r--r--core/sbase/patch/0001-Revert-Fix-showing-directories-when-R-flag-is-set-in.patch30
-rw-r--r--core/sbase/patch/0002-Revert-ls-only-display-directory-headers-when-more-t.patch44
-rw-r--r--core/sbase/patch/0003-ls-Don-t-show-directory-name-with-single-directory-o.patch45
-rw-r--r--core/sbase/patch/0004-ls-Simplify-some-logic.patch74
-rw-r--r--core/sbase/patch/0005-sort-Fix-line-comparison-when-col-buffer-contains-da.patch112
-rw-r--r--core/sbase/patch/0006-linecmp-Handle-NUL-bytes-properly.patch41
-rw-r--r--core/sbase/patch/0007-od-Add-some-missing-type-flags.patch67
-rw-r--r--core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch43
-rw-r--r--core/sbase/patch/0009-install-Handle-c-flag.patch26
-rw-r--r--core/sbase/patch/0010-ln-Only-fail-if-same-inode-without-f-flag.patch31
10 files changed, 0 insertions, 513 deletions
diff --git a/core/sbase/patch/0001-Revert-Fix-showing-directories-when-R-flag-is-set-in.patch b/core/sbase/patch/0001-Revert-Fix-showing-directories-when-R-flag-is-set-in.patch
deleted file mode 100644
index 07f405b1..00000000
--- a/core/sbase/patch/0001-Revert-Fix-showing-directories-when-R-flag-is-set-in.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 9a9c3e05e66f1a1fde22f95d70ff2810a580d49d Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 14 May 2016 16:31:40 -0700
-Subject: [PATCH] Revert "Fix showing directories when -R flag is set in ls(1)"
-
-This reverts commit bb83eade399e7d6f3642ae3a5e2cdebab6f222a1.
-
-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.
----
- ls.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ls.c b/ls.c
-index 8cc285b..a59cc0a 100644
---- a/ls.c
-+++ b/ls.c
-@@ -278,7 +278,7 @@ lsdir(const char *path, const struct entry *dir)
- if (!Uflag)
- qsort(ents, n, sizeof(*ents), entcmp);
-
-- if (ds++)
-+ if (ds > 1 && (path[0] || dir->name[0] != '.'))
- printf("%s:\n", dir->name);
- for (i = 0; i < n; i++)
- output(&ents[i]);
---
-2.8.1
-
diff --git a/core/sbase/patch/0002-Revert-ls-only-display-directory-headers-when-more-t.patch b/core/sbase/patch/0002-Revert-ls-only-display-directory-headers-when-more-t.patch
deleted file mode 100644
index 2d2427b0..00000000
--- a/core/sbase/patch/0002-Revert-ls-only-display-directory-headers-when-more-t.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 6ce4e756d6cf5a4cc5539a57b93fcacbfb7654a6 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 14 May 2016 16:54:32 -0700
-Subject: [PATCH] Revert "ls: only display directory headers when more than one
- directory is specified"
-
-This reverts commit b107489bf2cda579ca53551206270b9eee80c059.
----
- ls.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/ls.c b/ls.c
-index a59cc0a..55dfe40 100644
---- a/ls.c
-+++ b/ls.c
-@@ -53,7 +53,6 @@ static int Uflag = 0;
- static int uflag = 0;
- static int first = 1;
- static char sort = 0;
--static size_t ds = 0;
-
- static void ls(const char *, const struct entry *, int);
-
-@@ -278,7 +277,7 @@ lsdir(const char *path, const struct entry *dir)
- if (!Uflag)
- qsort(ents, n, sizeof(*ents), entcmp);
-
-- if (ds > 1 && (path[0] || dir->name[0] != '.'))
-+ if (path[0] || dir->name[0] != '.')
- printf("%s:\n", dir->name);
- for (i = 0; i < n; i++)
- output(&ents[i]);
-@@ -369,7 +368,7 @@ int
- main(int argc, char *argv[])
- {
- struct entry ent, *dents, *fents;
-- size_t i, fs;
-+ size_t i, ds, fs;
-
- ARGBEGIN {
- case '1':
---
-2.8.1
-
diff --git a/core/sbase/patch/0003-ls-Don-t-show-directory-name-with-single-directory-o.patch b/core/sbase/patch/0003-ls-Don-t-show-directory-name-with-single-directory-o.patch
deleted file mode 100644
index 5bc0b615..00000000
--- a/core/sbase/patch/0003-ls-Don-t-show-directory-name-with-single-directory-o.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From ec8d61a6fd614ee6742cd46bf7ffc6b67391c766 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 14 May 2016 18:13:22 -0700
-Subject: [PATCH] ls: Don't show directory name with single directory operand
-
-This fixes the issue b107489bf2cda579ca53551206270b9eee80c059 tried
-to fix, but doesn't break -R (which
-bb83eade399e7d6f3642ae3a5e2cdebab6f222a1 tried to fix).
----
- ls.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/ls.c b/ls.c
-index 55dfe40..42811c5 100644
---- a/ls.c
-+++ b/ls.c
-@@ -53,6 +53,7 @@ static int Uflag = 0;
- static int uflag = 0;
- static int first = 1;
- static char sort = 0;
-+static int showdirs;
-
- static void ls(const char *, const struct entry *, int);
-
-@@ -277,7 +278,7 @@ lsdir(const char *path, const struct entry *dir)
- if (!Uflag)
- qsort(ents, n, sizeof(*ents), entcmp);
-
-- if (path[0] || dir->name[0] != '.')
-+ if (path[0] || showdirs)
- printf("%s:\n", dir->name);
- for (i = 0; i < n; i++)
- output(&ents[i]);
-@@ -469,6 +470,8 @@ main(int argc, char *argv[])
- }
- }
-
-+ showdirs = ds > 1 || (ds && fs);
-+
- qsort(fents, fs, sizeof(ent), entcmp);
- qsort(dents, ds, sizeof(ent), entcmp);
-
---
-2.8.1
-
diff --git a/core/sbase/patch/0004-ls-Simplify-some-logic.patch b/core/sbase/patch/0004-ls-Simplify-some-logic.patch
deleted file mode 100644
index 0ad6a1af..00000000
--- a/core/sbase/patch/0004-ls-Simplify-some-logic.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 19d79dc27a724fd9553e8a99511854fb1dbc3c58 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 14 May 2016 18:25:11 -0700
-Subject: [PATCH] ls: Simplify some logic
-
-- 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.
----
- ls.c | 15 +++++++--------
- 1 file changed, 7 insertions(+), 8 deletions(-)
-
-diff --git a/ls.c b/ls.c
-index 42811c5..b5c4b00 100644
---- a/ls.c
-+++ b/ls.c
-@@ -279,7 +279,7 @@ lsdir(const char *path, const struct entry *dir)
- qsort(ents, n, sizeof(*ents), entcmp);
-
- if (path[0] || showdirs)
-- printf("%s:\n", dir->name);
-+ printf("%s%s:\n", path, dir->name);
- for (i = 0; i < n; i++)
- output(&ents[i]);
-
-@@ -296,7 +296,7 @@ lsdir(const char *path, const struct entry *dir)
- if (S_ISLNK(ent->mode) && S_ISDIR(ent->tmode) && !Lflag)
- continue;
-
-- ls(prefix, ent, Rflag);
-+ ls(prefix, ent, 1);
- }
- }
-
-@@ -346,11 +346,10 @@ ls(const char *path, const struct entry *ent, int listdir)
- eprintf("getcwd:");
-
- if (first)
-- first = !first;
-+ first = 0;
- else
- putchar('\n');
-
-- fputs(path, stdout);
- lsdir(path, ent);
- tree[treeind].ino = 0;
-
-@@ -451,8 +450,8 @@ main(int argc, char *argv[])
- case 1:
- mkent(&ent, argv[0], 1, Hflag || Lflag);
- ls("", &ent, (!dflag && S_ISDIR(ent.mode)) ||
-- ((S_ISLNK(ent.mode) && S_ISDIR(ent.tmode)) &&
-- ((Hflag || Lflag) || !(dflag || Fflag || lflag))));
-+ (S_ISLNK(ent.mode) && S_ISDIR(ent.tmode) &&
-+ !(dflag || Fflag || lflag)));
-
- break;
- default:
-@@ -460,8 +459,8 @@ main(int argc, char *argv[])
- mkent(&ent, argv[i], 1, Hflag || Lflag);
-
- if ((!dflag && S_ISDIR(ent.mode)) ||
-- ((S_ISLNK(ent.mode) && S_ISDIR(ent.tmode)) &&
-- ((Hflag || Lflag) || !(dflag || Fflag || lflag)))) {
-+ (S_ISLNK(ent.mode) && S_ISDIR(ent.tmode) &&
-+ !(dflag || Fflag || lflag))) {
- dents = ereallocarray(dents, ++ds, sizeof(*dents));
- memcpy(&dents[ds - 1], &ent, sizeof(ent));
- } else {
---
-2.8.1
-
diff --git a/core/sbase/patch/0005-sort-Fix-line-comparison-when-col-buffer-contains-da.patch b/core/sbase/patch/0005-sort-Fix-line-comparison-when-col-buffer-contains-da.patch
deleted file mode 100644
index dce7e9b9..00000000
--- a/core/sbase/patch/0005-sort-Fix-line-comparison-when-col-buffer-contains-da.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From da15434afe0c4b133961328cfff3a230741d7150 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 14 May 2016 15:16:16 -0700
-Subject: [PATCH] sort: Fix line comparison when col buffer contains data from
- longer line
-
-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
----
- sort.c | 37 ++++++++++++++++++++-----------------
- 1 file changed, 20 insertions(+), 17 deletions(-)
-
-diff --git a/sort.c b/sort.c
-index 90ee911..623b81e 100644
---- a/sort.c
-+++ b/sort.c
-@@ -18,6 +18,11 @@ struct keydef {
- TAILQ_ENTRY(keydef) entry;
- };
-
-+struct column {
-+ struct line line;
-+ size_t cap;
-+};
-+
- enum {
- MOD_N = 1 << 0,
- MOD_STARTB = 1 << 1,
-@@ -33,7 +38,7 @@ static TAILQ_HEAD(kdhead, keydef) kdhead = TAILQ_HEAD_INITIALIZER(kdhead);
- static int Cflag = 0, cflag = 0, uflag = 0;
- static char *fieldsep = NULL;
- static size_t fieldseplen = 0;
--static struct line col1, col2;
-+static struct column col1, col2;
-
- static void
- skipblank(struct line *a)
-@@ -76,12 +81,12 @@ skipcolumn(struct line *a, int skip_to_next_col)
- }
- }
-
--static size_t
--columns(struct line *line, const struct keydef *kd, struct line *col)
-+static void
-+columns(struct line *line, const struct keydef *kd, struct column *col)
- {
- Rune r;
- struct line start, end;
-- size_t len, utflen, rlen;
-+ size_t utflen, rlen;
- int i;
-
- start.data = line->data;
-@@ -118,15 +123,13 @@ columns(struct line *line, const struct keydef *kd, struct line *col)
- end.data += end.len - 1;
- end.len = 1;
- }
-- len = MAX(0, end.data - start.data);
-- if (!(col->data) || col->len < len)
-- col->data = erealloc(col->data, len + 1);
-- memcpy(col->data, start.data, len);
-- col->data[len] = '\0';
-- if (col->len < len)
-- col->len = len;
--
-- return len;
-+ col->line.len = MAX(0, end.data - start.data);
-+ if (!(col->line.data) || col->cap < col->line.len + 1) {
-+ free(col->line.data);
-+ col->line.data = emalloc(col->line.len + 1);
-+ }
-+ memcpy(col->line.data, start.data, col->line.len);
-+ col->line.data[col->line.len] = '\0';
- }
-
- static int
-@@ -187,13 +190,13 @@ slinecmp(struct line *a, struct line *b)
- TAILQ_LAST(&kdhead, kdhead) != TAILQ_FIRST(&kdhead)) {
- res = 0;
- } else if (kd->flags & MOD_N) {
-- x = strtold(col1.data, NULL);
-- y = strtold(col2.data, NULL);
-+ x = strtold(col1.line.data, NULL);
-+ y = strtold(col2.line.data, NULL);
- res = (x < y) ? -1 : (x > y);
- } else if (kd->flags & (MOD_D | MOD_F | MOD_I)) {
-- res = skipmodcmp(&col1, &col2, kd->flags);
-+ res = skipmodcmp(&col1.line, &col2.line, kd->flags);
- } else {
-- res = linecmp(&col1, &col2);
-+ res = linecmp(&col1.line, &col2.line);
- }
-
- if (kd->flags & MOD_R)
---
-2.8.1
-
diff --git a/core/sbase/patch/0006-linecmp-Handle-NUL-bytes-properly.patch b/core/sbase/patch/0006-linecmp-Handle-NUL-bytes-properly.patch
deleted file mode 100644
index a2a1f8d2..00000000
--- a/core/sbase/patch/0006-linecmp-Handle-NUL-bytes-properly.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 3ad1087dc420ded3cb279fd0c2039b12994328a8 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 14 May 2016 15:27:31 -0700
-Subject: [PATCH] linecmp: Handle NUL bytes properly
-
-Test case:
-
-if [ "$(printf 'a\na\0b' | ./sort -u)" = "$(printf 'a\na\0b')" ] ; then
- echo pass
-else
- echo fail
-fi
----
- libutil/linecmp.c | 11 ++---------
- 1 file changed, 2 insertions(+), 9 deletions(-)
-
-diff --git a/libutil/linecmp.c b/libutil/linecmp.c
-index f5a6cf9..08fc0e3 100644
---- a/libutil/linecmp.c
-+++ b/libutil/linecmp.c
-@@ -10,15 +10,8 @@ linecmp(struct line *a, struct line *b)
- {
- int res = 0;
-
-- if (!(res = memcmp(a->data, b->data, MIN(a->len, b->len)))) {
-- if (a->len > b->len) {
-- res = a->data[b->len];
-- } else if (b->len > a->len) {
-- res = -b->data[a->len];
-- } else {
-- res = 0;
-- }
-- }
-+ if (!(res = memcmp(a->data, b->data, MIN(a->len, b->len))))
-+ res = a->len - b->len;
-
- return res;
- }
---
-2.8.1
-
diff --git a/core/sbase/patch/0007-od-Add-some-missing-type-flags.patch b/core/sbase/patch/0007-od-Add-some-missing-type-flags.patch
deleted file mode 100644
index 68c5a8ea..00000000
--- a/core/sbase/patch/0007-od-Add-some-missing-type-flags.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 8f5bc3b12e214eb94e607202e26d8377ca30519c Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 4 Jun 2016 23:26:08 -0700
-Subject: [PATCH] od: Add some missing type flags
-
----
- od.c | 30 ++++++++++++++++++++++++++++++
- 1 file changed, 30 insertions(+)
-
-diff --git a/od.c b/od.c
-index 5a625b6..b88e514 100644
---- a/od.c
-+++ b/od.c
-@@ -197,6 +197,18 @@ main(int argc, char *argv[])
- usage();
- addr_format = s[0];
- break;
-+ case 'b':
-+ t = emalloc(sizeof(struct type));
-+ t->format = 'o';
-+ t->len = 1;
-+ TAILQ_INSERT_TAIL(&head, t, entry);
-+ break;
-+ case 'd':
-+ t = emalloc(sizeof(struct type));
-+ t->format = 'u';
-+ t->len = 2;
-+ TAILQ_INSERT_TAIL(&head, t, entry);
-+ break;
- case 'E':
- case 'e':
- big_endian = (ARGC() == 'E');
-@@ -209,6 +221,18 @@ main(int argc, char *argv[])
- if ((max = parseoffset(EARGF(usage()))) < 0)
- usage();
- break;
-+ case 'o':
-+ t = emalloc(sizeof(struct type));
-+ t->format = 'o';
-+ t->len = 2;
-+ TAILQ_INSERT_TAIL(&head, t, entry);
-+ break;
-+ case 's':
-+ t = emalloc(sizeof(struct type));
-+ t->format = 'd';
-+ t->len = 2;
-+ TAILQ_INSERT_TAIL(&head, t, entry);
-+ break;
- case 't':
- s = EARGF(usage());
- for (; *s; s++) {
-@@ -256,6 +280,12 @@ main(int argc, char *argv[])
- case 'v':
- /* always set - use uniq(1) to handle duplicate lines */
- break;
-+ case 'x':
-+ t = emalloc(sizeof(struct type));
-+ t->format = 'x';
-+ t->len = 2;
-+ TAILQ_INSERT_TAIL(&head, t, entry);
-+ break;
- default:
- usage();
- } ARGEND
---
-2.8.1
-
diff --git a/core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch b/core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch
deleted file mode 100644
index 0c53fe5f..00000000
--- a/core/sbase/patch/0008-od-Don-t-advance-past-end-of-type-string.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 489fd212950383b7c9375581f04095843ef67e83 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 4 Jun 2016 23:26:43 -0700
-Subject: [PATCH] od: Don't advance past end of type string
-
-Also, use sizeof(int) when no length is specified.
----
- od.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/od.c b/od.c
-index b88e514..529f636 100644
---- a/od.c
-+++ b/od.c
-@@ -251,9 +251,9 @@ main(int argc, char *argv[])
- t->format = *s;
- /* todo: allow multiple digits */
- if (*(s+1) > '0' && *(s+1) <= '9') {
-- t->len = *(++s) - '0';
-+ t->len = *(s+1) - '0';
- } else {
-- switch (*(++s)) {
-+ switch (*(s+1)) {
- case 'C':
- t->len = sizeof(char);
- break;
-@@ -267,9 +267,12 @@ main(int argc, char *argv[])
- t->len = sizeof(long);
- break;
- default:
-- t->len = 4;
-+ t->len = sizeof(int);
-+ goto insert;
- }
- }
-+ ++s;
-+ insert:
- TAILQ_INSERT_TAIL(&head, t, entry);
- break;
- default:
---
-2.8.1
-
diff --git a/core/sbase/patch/0009-install-Handle-c-flag.patch b/core/sbase/patch/0009-install-Handle-c-flag.patch
deleted file mode 100644
index e42d70b7..00000000
--- a/core/sbase/patch/0009-install-Handle-c-flag.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 8138dce28e676e77b189f3bd94d640ea268d361f Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sat, 4 Jun 2016 23:42:30 -0700
-Subject: [PATCH] install: Handle -c flag
-
----
- xinstall.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/xinstall.c b/xinstall.c
-index f5f6956..bf921fb 100644
---- a/xinstall.c
-+++ b/xinstall.c
-@@ -156,6 +156,9 @@ main(int argc, char *argv[])
- char *p;
-
- ARGBEGIN {
-+ case 'c':
-+ /* no-op for compatibility */
-+ break;
- case 'd':
- dflag = 1;
- break;
---
-2.8.1
-
diff --git a/core/sbase/patch/0010-ln-Only-fail-if-same-inode-without-f-flag.patch b/core/sbase/patch/0010-ln-Only-fail-if-same-inode-without-f-flag.patch
deleted file mode 100644
index 4612bb27..00000000
--- a/core/sbase/patch/0010-ln-Only-fail-if-same-inode-without-f-flag.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 8f22e7778c6bb5c43c69bf0035cfca3fa94957d4 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 3 Jul 2016 03:04:16 -0700
-Subject: [PATCH] ln: Only fail if same inode without -f flag
-
----
- ln.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/ln.c b/ln.c
-index ab1ec4e..f62068a 100644
---- a/ln.c
-+++ b/ln.c
-@@ -77,9 +77,11 @@ main(int argc, char *argv[])
- continue;
- }
- } else if (st.st_dev == tst.st_dev && st.st_ino == tst.st_ino) {
-- weprintf("%s and %s/%s are the same file\n",
-- *argv, targetdir, target);
-- ret = 1;
-+ if (!fflag) {
-+ weprintf("%s and %s/%s are the same file\n",
-+ *argv, targetdir, target);
-+ ret = 1;
-+ }
- continue;
- }
- }
---
-2.9.0
-