diff --git a/quota-4.06-common.c-fix-strncat-usage.patch b/quota-4.06-common.c-fix-strncat-usage.patch new file mode 100644 index 0000000..da5aaed --- /dev/null +++ b/quota-4.06-common.c-fix-strncat-usage.patch @@ -0,0 +1,43 @@ +From b0f95e3954f85d97a99f8a08645418945484dbca Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Wed, 1 Sep 2021 08:00:00 +0000 +Subject: [PATCH 2/3] common.c: fix strncat usage + +When quota is configured using --enable-werror, gcc -flto fails with +the following diagnostics: + +In function 'strncat', + inlined from 'sstrncat' at common.c:113:2, + inlined from 'get_proc_num' at quotastats.c:46:2: +/usr/include/bits/string_fortified.h:122:10: error: '__builtin___strncat_chk' specified bound 4096 equals destination size [-Werror=str +ingop-overflow=] + 122 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); + | ^ + +This diagnostics is correct: when "src" contains "len" or more bytes, +strncat() writes "len"+1 bytes to "dest" ("len" from "src" plus +the terminating null byte). + +Signed-off-by: Dmitry V. Levin +Signed-off-by: Jan Kara +--- + common.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/common.c b/common.c +index 8be0428..b3e5ad2 100644 +--- a/common.c ++++ b/common.c +@@ -110,8 +110,7 @@ void sstrncpy(char *d, const char *s, size_t len) + + void sstrncat(char *d, const char *s, size_t len) + { +- strncat(d, s, len); +- d[len - 1] = 0; ++ strncat(d, s, len - 1); + } + + char *sstrdup(const char *s) +-- +2.31.1 + diff --git a/quota-4.06-quotacheck-quotaon-Always-display-message-about-depr.patch b/quota-4.06-quotacheck-quotaon-Always-display-message-about-depr.patch new file mode 100644 index 0000000..8a7a71f --- /dev/null +++ b/quota-4.06-quotacheck-quotaon-Always-display-message-about-depr.patch @@ -0,0 +1,68 @@ +From 100b8a8814152ca6f52564cb65f33bf7cf033c22 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Fri, 20 Aug 2021 21:51:05 +0200 +Subject: [PATCH 1/3] quotacheck, quotaon: Always display message about + deprecated usage + +Visible quota files on ext4 filesystem are deprecated. Make sure we +always display the warning message and also expand the message to +explain how the filesystem can be converted. + +Signed-off-by: Jan Kara +--- + quotacheck.c | 7 +++++-- + quotaon.c | 7 ++++--- + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/quotacheck.c b/quotacheck.c +index 1b81610..bd62d9a 100644 +--- a/quotacheck.c ++++ b/quotacheck.c +@@ -1198,7 +1198,7 @@ static int check_all(void) + debug(FL_DEBUG, _("Detected quota format %s\n"), fmt2name(cfmt)); + } + +- if (flags & (FL_VERBOSE | FL_DEBUG) && !warned) { ++ if (!warned) { + if (!strcmp(mnt->me_type, MNTTYPE_EXT4) && + ext4_supports_quota_feature()) { + warned = 1; +@@ -1207,7 +1207,10 @@ static int check_all(void) + "external quota files. Please switch " + "your filesystem to use ext4 quota " + "feature as external quota files on " +- "ext4 are deprecated.\n")); ++ "ext4 are deprecated. You can enable " ++ "the feature by unmounting the file " ++ "system and running 'tune2fs -O quota " ++ "'.\n")); + } else if (!str_hasmntopt(mnt->me_opts, MNTOPT_USRJQUOTA) && + !str_hasmntopt(mnt->me_opts, MNTOPT_GRPJQUOTA) && + (!strcmp(mnt->me_type, MNTTYPE_EXT3) || +diff --git a/quotaon.c b/quotaon.c +index aceb6ec..125b934 100644 +--- a/quotaon.c ++++ b/quotaon.c +@@ -270,15 +270,16 @@ static int newstate(struct mount_entry *mnt, int type, char *extra) + + if (!me_hasquota(mnt, type)) + return 0; +- if (flags & FL_VERBOSE && !warned && +- !strcmp(mnt->me_type, MNTTYPE_EXT4) && ++ if (!warned && !strcmp(mnt->me_type, MNTTYPE_EXT4) && + ext4_supports_quota_feature()) { + warned = 1; + errstr(_("Your kernel probably supports ext4 quota " + "feature but you are using external quota " + "files. Please switch your filesystem to use " + "ext4 quota feature as external quota files " +- "on ext4 are deprecated.\n")); ++ "on ext4 are deprecated. You can enable the " ++ "feature by unmounting the file system and " ++ "running 'tune2fs -O quota '.\n")); + } + if (fmt == -1) { + if (get_qf_name(mnt, type, QF_VFSV0, +-- +2.31.1 + diff --git a/quota-4.06-quotasys.c-fix-strncpy-usage.patch b/quota-4.06-quotasys.c-fix-strncpy-usage.patch new file mode 100644 index 0000000..7e14d48 --- /dev/null +++ b/quota-4.06-quotasys.c-fix-strncpy-usage.patch @@ -0,0 +1,46 @@ +From d2256ac2d44b0a5be9c0b49ce4ce8e5f6821ce2a Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Wed, 1 Sep 2021 08:00:00 +0000 +Subject: [PATCH 3/3] quotasys.c: fix strncpy usage + +When quota is configured using --enable-werror, gcc -flto fails with +the following diagnostics: + +In function 'strncpy', + inlined from 'sstrncpy' at common.c:107:2, + inlined from 'copy_mntoptarg' at quotasys.c:774:3, + inlined from 'copy_mntoptarg' at quotasys.c:769:13: +/usr/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=] + 91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); + | ^ +quotasys.c: In function 'copy_mntoptarg': +quotasys.c:774:25: note: length computed here + 774 | sstrncpy(buf, optarg, min(buflen, strlen(optarg) + 1)); + | ^ + +This diagnostics is correct: strcpy() copies at most "len" bytes of the string +pointed to by "src", including the terminating null byte, to the buffer +pointed to by "dest". + +Signed-off-by: Dmitry V. Levin +Signed-off-by: Jan Kara +--- + quotasys.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/quotasys.c b/quotasys.c +index 885fb1f..3f50e32 100644 +--- a/quotasys.c ++++ b/quotasys.c +@@ -771,7 +771,7 @@ static void copy_mntoptarg(char *buf, const char *optarg, int buflen) + char *sep = strchr(optarg, ','); + + if (!sep) +- sstrncpy(buf, optarg, min(buflen, strlen(optarg) + 1)); ++ sstrncpy(buf, optarg, buflen); + else + sstrncpy(buf, optarg, min(buflen, sep - optarg + 1)); + } +-- +2.31.1 + diff --git a/quota.spec b/quota.spec index b9584ac..8486ad6 100644 --- a/quota.spec +++ b/quota.spec @@ -13,7 +13,7 @@ Name: quota Epoch: 1 Version: 4.06 -Release: 6%{?dist} +Release: 7%{?dist} Summary: System administration tools for monitoring users' disk usage # quota_nld.c, quotaio_xfs.h: GPLv2 # bylabel.c copied from util-linux: GPLv2+ @@ -72,6 +72,10 @@ Patch5: quota-4.06-Drop-sys-cdefs.h-usage.patch # Fix sa_mask initialization when registering PID file removal, # upstream bug #141, in upstream after 4.06 Patch6: quota-4.06-quota_nld-Initialize-sa_mask-when-registering-PID-fi.patch +Patch7: quota-4.06-quotacheck-quotaon-Always-display-message-about-depr.patch +Patch8: quota-4.06-common.c-fix-strncat-usage.patch +Patch9: quota-4.06-quotasys.c-fix-strncpy-usage.patch + BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -348,6 +352,11 @@ make check %changelog +* Fri Jan 21 2022 Lukas Czerner - 1:4.06-7 +- Always display message about deprecated usage in quotacheck and quotaon +- Fix strncat usage in common.c +- Fix strncpy usage quotasys.c + * Fri Jul 23 2021 Fedora Release Engineering - 1:4.06-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild