Compare commits

...

4 Commits

Author SHA256 Message Date
Dominique Leuenberger
137593000d Accepting request 1190301 from Base:System
OBS-URL: https://build.opensuse.org/request/show/1190301
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=159
2024-07-31 11:27:58 +00:00
e2d1dcb647 - Avoid empty scriptlets
OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=366
2024-07-29 16:54:07 +00:00
Ana Guerrero
9740f8f158 Accepting request 1186697 from Base:System
OBS-URL: https://build.opensuse.org/request/show/1186697
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=158
2024-07-12 15:04:18 +00:00
Bernhard Voelker
a296bffe53 - coreutils-i18n.patch: fold(1): fix exit code for non-existent file.
The exit code of fold(1) was zero for non-existent file:
    $ fold badfile; echo $?
    fold: badfile: No such file or directory
    0

  * coreutils-i18n.patch (src/fold.c:fold_file): Fix incorrect return code
  for non-existent files; the I18N patch incorrectly returned an integer
  instead of a bool on failure.
  While at it, also fix the assignment to 'have_read_stdin' to bool.

  The bug was introduced by the downstrean I18N patch. (rhbz#2296201)
  Based on patch by Sohum Mendon <sohum.mendon@proton.me>.

OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=364
2024-07-10 21:09:17 +00:00
3 changed files with 35 additions and 19 deletions

View File

@ -1541,12 +1541,13 @@ Index: coreutils-9.5/src/fold.c
- saved_errno = errno;
+ *saved_errno = errno;
+ if (!ferror (istream))
if (!ferror (istream))
- saved_errno = 0;
+ *saved_errno = 0;
+
+ if (offset_out)
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
+
if (offset_out)
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
+}
+
+#if HAVE_MBRTOWC
@ -1718,19 +1719,18 @@ Index: coreutils-9.5/src/fold.c
+ }
+
+ *saved_errno = errno;
if (!ferror (istream))
- saved_errno = 0;
+ if (!ferror (istream))
+ *saved_errno = 0;
if (offset_out)
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
+
+ if (offset_out)
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
+
+}
+#endif
+
+/* Fold file FILENAME, or standard input if FILENAME is "-",
+ to stdout, with maximum line length WIDTH.
+ Return 0 if successful, 1 if an error occurs. */
+ Return true if successful. */
+
+static bool
+fold_file (char const *filename, size_t width)
@ -1741,15 +1741,15 @@ Index: coreutils-9.5/src/fold.c
+ if (STREQ (filename, "-"))
+ {
+ istream = stdin;
+ have_read_stdin = 1;
+ have_read_stdin = true;
+ }
+ else
+ istream = fopen (filename, "r");
+
+ if (istream == NULL)
+ if (istream == nullptr)
+ {
+ error (0, errno, "%s", filename);
+ return 1;
+ return false;
+ }
+
+ /* Define how ISTREAM is being folded. */

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri Jul 19 07:57:52 UTC 2024 - Andreas Schwab <schwab@suse.de>
- Avoid empty scriptlets
-------------------------------------------------------------------
Tue Jul 9 20:22:23 UTC 2024 - Bernhard Voelker <mail@bernhard-voelker.de>
- coreutils-i18n.patch: fold(1): fix exit code for non-existent file.
The exit code of fold(1) was zero for non-existent file:
$ fold badfile; echo $?
fold: badfile: No such file or directory
0
The bug was introduced by the downstrean I18N patch. (rhbz#2296201)
-------------------------------------------------------------------
Mon Apr 1 18:07:16 UTC 2024 - Bernhard Voelker <mail@bernhard-voelker.de>

View File

@ -239,18 +239,19 @@ install src/{pinky,uptime,users,who} %{buildroot}%{_bindir}/
%endif
# ================================================
%post
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%post
%{?regenerate_initrd_post}
%endif
# ================================================
%posttrans
%dnl ================================================
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%posttrans
%{?regenerate_initrd_posttrans}
%endif
# ================================================
%dnl ================================================
%files
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"