Compare commits

..

2 Commits
rawhide ... f30

Author SHA1 Message Date
Karel Zak 7e12d72cdc 2.33.2-2: fix #1731407 (libmount mem-leak) 2019-07-19 12:51:30 +02:00
Karel Zak e0091fb996 2.33.2-1: upgrade 2019-04-09 16:11:49 +02:00
11 changed files with 468 additions and 482 deletions

22
.gitignore vendored
View File

@ -68,25 +68,3 @@
/util-linux-2.33-rc2.tar.xz
/util-linux-2.33.1.tar.xz
/util-linux-2.33.2.tar.xz
/util-linux-2.34-rc1.tar.xz
/util-linux-2.34-rc2.tar.xz
/util-linux-2.34.tar.xz
/util-linux-2.35-rc1.tar.xz
/util-linux-2.35-rc1-20-63f8.tar.xz
/util-linux-2.35-rc2.tar.xz
/util-linux-2.35.tar.xz
/util-linux-2.35.1.tar.xz
/util-linux-2.35.2.tar.xz
/util-linux-2.36.tar.xz
/util-linux-2.36.1.tar.xz
/util-linux-2.36.2.tar.xz
/util-linux-2.37-rc2.tar.xz
/util-linux-2.37.tar.xz
/util-linux-2.37.2.tar.xz
/util-linux-2.38-rc1.tar.xz
/util-linux-2.38-rc3.tar.xz
/util-linux-2.38.tar.xz
/util-linux-2.38.1.tar.xz
/util-linux-2.39-rc1.tar.xz
/util-linux-2.39-rc2.tar.xz
/util-linux-2.39-rc3.tar.xz

View File

@ -0,0 +1,12 @@
diff -up util-linux-2.28/login-utils/login.c.kzak util-linux-2.28/login-utils/login.c
--- util-linux-2.28/login-utils/login.c.kzak 2016-03-08 14:28:16.724156218 +0100
+++ util-linux-2.28/login-utils/login.c 2016-04-26 12:45:29.235326017 +0200
@@ -510,7 +510,7 @@ static void log_lastlog(struct login_con
sa.sa_handler = SIG_IGN;
sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
- fd = open(_PATH_LASTLOG, O_RDWR, 0);
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
if (fd < 0)
goto done;

View File

@ -0,0 +1,148 @@
From 651c5d428c2ef103ee8c5b1a310d6f29f0304744 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 27 Mar 2018 10:40:13 +0200
Subject: [PATCH] column: fix leading space characters bug
The bug has been introduced during column(1) rewrite. The function
read_input() need to skip leading space only temporary to detect empty
lines, but the rest of the code has to use the original buffer (line).
I've tried to fix one of the symptoms by 5c7b67fbbf41c973ca8d49b1e8bdba22dbb917aa
(alter), but this solution is unnecessary and too complex.
Changes:
* don't ignore leading space
* remove unnecessary stuff introduced by 5c7b67fbbf41c973ca8d49b1e8bdba22dbb917aa
* fix regression test with incorrect separator
Addresses: https://github.com/karelzak/util-linux/issues/575
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1560283
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/expected/column/table-input-separator-space | 2 +-
tests/ts/column/table | 2 +-
text-utils/column.c | 36 ++---------------------
4 files changed, 5 insertions(+), 38 deletions(-)
diff --git a/tests/expected/column/table-input-separator-space b/tests/expected/column/table-input-separator-space
index 8a6513c11..25d9b5ab0 100644
--- a/tests/expected/column/table-input-separator-space
+++ b/tests/expected/column/table-input-separator-space
@@ -1,5 +1,5 @@
AAA BBBB C DDDD
-BBB CCCC DDD
+ BBB CCCC DDD
AA BB DD
AAAA B CC D
AA CC DD
diff --git a/tests/ts/column/table b/tests/ts/column/table
index 27b52e7c8..5c89d5eaf 100755
--- a/tests/ts/column/table
+++ b/tests/ts/column/table
@@ -37,7 +37,7 @@ $TS_CMD_COLUMN --separator ',' --table $TS_SELF/files/table-sep >> $TS_OUTPUT 2>
ts_finalize_subtest
ts_init_subtest "input-separator-space"
-$TS_CMD_COLUMN --separator ',' --table $TS_SELF/files/table-sep-space >> $TS_OUTPUT 2>&1
+$TS_CMD_COLUMN --separator "$(echo -e '\t')" --table $TS_SELF/files/table-sep-space >> $TS_OUTPUT 2>&1
ts_finalize_subtest
ts_init_subtest "long"
diff --git a/text-utils/column.c b/text-utils/column.c
index 89d46d280..195814328 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -86,7 +86,6 @@ struct column_control {
const char *tree_parent;
wchar_t *input_separator;
- char *input_separator_raw;
const char *output_separator;
wchar_t **ents; /* input entries */
@@ -96,7 +95,6 @@ struct column_control {
unsigned int greedy :1,
json :1,
header_repeat :1,
- input_sep_space : 1, /* input separator contains space chars */
tab_noheadings :1;
};
@@ -470,19 +468,7 @@ static int read_input(struct column_control *ctl, FILE *fp)
char *buf = NULL;
size_t bufsz = 0;
size_t maxents = 0;
- int rc = 0, is_space_sep = 0;
-
- /* Check if columns separator contains spaces chars */
- if (ctl->mode == COLUMN_MODE_TABLE && ctl->input_separator_raw) {
- char *p;
-
- for (p = ctl->input_separator_raw; *p; p++) {
- if (isspace(*p)) {
- is_space_sep = 1;
- break;
- }
- }
- }
+ int rc = 0;
/* Read input */
do {
@@ -496,19 +482,6 @@ static int read_input(struct column_control *ctl, FILE *fp)
err(EXIT_FAILURE, _("read failed"));
}
str = (char *) skip_space(buf);
-
- /* The table columns separator could be a space. In this case
- * don't skip the separator if at begin of the line. For example:
- *
- * echo -e "\tcol1\tcol2\nrow\t1\t2" \
- * | column -t -s "$(echo -e '\t')" --table-columns A,B,C
- */
- if (is_space_sep && str > buf) {
- char *x = strpbrk(buf, ctl->input_separator_raw);
- if (x && x < str)
- str = x;
- }
-
if (str) {
p = strchr(str, '\n');
if (p)
@@ -517,13 +490,13 @@ static int read_input(struct column_control *ctl, FILE *fp)
if (!str || !*str)
continue;
- wcs = mbs_to_wcs(str);
+ wcs = mbs_to_wcs(buf);
if (!wcs) {
/*
* Convert broken sequences to \x<hex> and continue.
*/
size_t tmpsz = 0;
- char *tmp = mbs_invalid_encode(str, &tmpsz);
+ char *tmp = mbs_invalid_encode(buf, &tmpsz);
if (!tmp)
err(EXIT_FAILURE, _("read failed"));
@@ -720,7 +693,6 @@ int main(int argc, char **argv)
ctl.output_separator = " ";
ctl.input_separator = mbs_to_wcs("\t ");
- ctl.input_separator_raw = xstrdup("\t ");
while ((c = getopt_long(argc, argv, "c:dE:eH:hi:JN:n:O:o:p:R:r:s:T:tVW:x", longopts, NULL)) != -1) {
@@ -775,9 +747,7 @@ int main(int argc, char **argv)
break;
case 's':
free(ctl.input_separator);
- free(ctl.input_separator_raw);
ctl.input_separator = mbs_to_wcs(optarg);
- ctl.input_separator_raw = xstrdup(optarg);
ctl.greedy = 0;
break;
case 'T':
--
2.14.3

View File

@ -0,0 +1,89 @@
From 82e39473a5b9139248c94a0d3b2f6432d57566cc Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 15 Apr 2019 12:55:46 +0200
Subject: [PATCH] libmount: fix memleak on parse errors
Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index 16e7956af..9b8bfc593 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -95,7 +95,7 @@ static inline const char *skip_nonspearator(const char *p)
static int mnt_parse_table_line(struct libmnt_fs *fs, const char *s)
{
int rc = 0;
- char *p;
+ char *p = NULL;
fs->passno = fs->freq = 0;
@@ -103,6 +103,7 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, const char *s)
p = unmangle(s, &s);
if (!p || (rc = __mnt_fs_set_source_ptr(fs, p))) {
DBG(TAB, ul_debug("tab parse error: [source]"));
+ free(p);
goto fail;
}
@@ -121,6 +122,7 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, const char *s)
p = unmangle(s, &s);
if (!p || (rc = __mnt_fs_set_fstype_ptr(fs, p))) {
DBG(TAB, ul_debug("tab parse error: [fstype]"));
+ free(p);
goto fail;
}
@@ -130,11 +132,13 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, const char *s)
p = unmangle(s, &s);
if (p && (rc = mnt_fs_set_options(fs, p))) {
DBG(TAB, ul_debug("tab parse error: [options]"));
+ free(p);
goto fail;
}
-
if (!p)
goto done;
+ free(p);
+
s = skip_separator(s);
if (!s || !*s)
goto done;
@@ -250,6 +254,7 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, const char *s)
p = unmangle(s, &s);
if (!p || (rc = __mnt_fs_set_fstype_ptr(fs, p))) {
DBG(TAB, ul_debug("tab parse error: [fstype]"));
+ free(p);
goto fail;
}
@@ -267,6 +272,7 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, const char *s)
p = unmangle(s, &s);
if (!p || (rc = __mnt_fs_set_source_ptr(fs, p))) {
DBG(TAB, ul_debug("tab parse error: [regular source]"));
+ free(p);
goto fail;
}
}
@@ -319,7 +325,8 @@ static int mnt_parse_utab_line(struct libmnt_fs *fs, const char *s)
char *v = unmangle(p + 4, &end);
if (!v)
goto enomem;
- __mnt_fs_set_source_ptr(fs, v);
+ if (__mnt_fs_set_source_ptr(fs, v))
+ free(v);
} else if (!fs->target && !strncmp(p, "TARGET=", 7)) {
fs->target = unmangle(p + 7, &end);
@@ -378,6 +385,7 @@ static int mnt_parse_swaps_line(struct libmnt_fs *fs, const char *s)
}
if (!p || (rc = __mnt_fs_set_source_ptr(fs, p))) {
DBG(TAB, ul_debug("tab parse error: [source]"));
+ free(p);
goto fail;
}
--
2.21.0

View File

@ -1,13 +0,0 @@
diff --git a/include/pathnames.h b/include/pathnames.h
index 3845d4c33..fac3a0783 100644
--- a/include/pathnames.h
+++ b/include/pathnames.h
@@ -41,7 +41,7 @@
#ifndef _PATH_MAILDIR
# define _PATH_MAILDIR "/var/spool/mail"
#endif
-#define _PATH_MOTDFILE "/usr/share/misc/motd:/run/motd:/etc/motd"
+#define _PATH_MOTDFILE "/usr/share/misc/motd:/run/motd:/run/motd.d:/etc/motd:/etc/motd.d"
#ifndef _PATH_NOLOGIN
# define _PATH_NOLOGIN "/etc/nologin"
#endif

View File

@ -1,12 +0,0 @@
diff -up util-linux-2.36/login-utils/login.c.kzak util-linux-2.36/login-utils/login.c
--- util-linux-2.36/login-utils/login.c.kzak 2020-07-23 14:13:26.777030764 +0200
+++ util-linux-2.36/login-utils/login.c 2020-07-23 14:11:22.793686983 +0200
@@ -585,7 +585,7 @@ static void log_lastlog(struct login_con
sa.sa_handler = SIG_IGN;
sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
- fd = open(_PATH_LASTLOG, O_RDWR, 0);
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
if (fd < 0)
goto done;
offset = cxt->pwd->pw_uid * sizeof(ll);

View File

@ -1 +1 @@
SHA512 (util-linux-2.39-rc3.tar.xz) = 8a93d32a5ceb38d50a4b2c8bfa48bcab7ec9b758c89b5a1a4f7fd74558dce37385bd7ea203345148d4389de4ea60ec42058f9d7889a8075d3e616773d085427e
SHA512 (util-linux-2.33.2.tar.xz) = ac88790a0272366b384b54df19cb28318014d98819d5d96aa05528ff17ab57a8c66d012a2f1b59caca4c5d4ea669e8c041e1123517c1f1c2d9960ef701aaf749

8
util-linux-60-raw.rules Normal file
View File

@ -0,0 +1,8 @@
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/usr/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/usr/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

View File

@ -7,6 +7,7 @@ password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
d /run/uuidd 2775 uuidd uuidd