diff options
author | PÁLI Gábor János <pali.gabor@gmail.com> | 2023-08-03 10:10:44 +0200 |
---|---|---|
committer | PÁLI Gábor János <pali.gabor@gmail.com> | 2023-09-16 17:58:03 +0200 |
commit | 89279d87c5d3e0ea330be1f927e3f3bc59dbc2a7 (patch) | |
tree | 353bc9a026d0140151e760efbc4f6a6a6b24a020 /aports/busybox/0010-sed-check-errors-writing-file-with-sed-i.patch | |
parent | 084335e136581edc28137b152cc559778224570e (diff) | |
download | freebsd-wifibox-alpine-89279d87c5d3e0ea330be1f927e3f3bc59dbc2a7.zip |
Update to Linux 6.1 and Alpine 3.18
- Update base-layout to 3.4.3
- Update busybox to 1.36.1
- Update iptables to 1.8.9
- Update linux-lts to 6.1.53
- Update to openrc to 0.48
- Update rtl8821ce to snapshot of 20230915
- Replace rtwB88 with a third-party driver
- Update rtw89 to snapshot of 20230913
- Import wpa_supplicant fixes from Arch Linux
Diffstat (limited to 'aports/busybox/0010-sed-check-errors-writing-file-with-sed-i.patch')
-rw-r--r-- | aports/busybox/0010-sed-check-errors-writing-file-with-sed-i.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/aports/busybox/0010-sed-check-errors-writing-file-with-sed-i.patch b/aports/busybox/0010-sed-check-errors-writing-file-with-sed-i.patch new file mode 100644 index 0000000..f1cc0a8 --- /dev/null +++ b/aports/busybox/0010-sed-check-errors-writing-file-with-sed-i.patch @@ -0,0 +1,63 @@ +From 97e305025e987e77da488133ded31c1e81a0282b Mon Sep 17 00:00:00 2001 +From: Dominique Martinet <dominique.martinet@atmark-techno.com> +Date: Wed, 16 Nov 2022 07:08:13 +0900 +Subject: [PATCH] sed: check errors writing file with sed -i +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +sed would currently not error if write failed when modifying a file. + +This can be reproduced with the following 'script': +$ sudo mount -t tmpfs tmpfs -o size=1M /tmp/m +$ sudo chmod 777 /tmp/m +$ echo foo > /tmp/m/foo +$ dd if=/dev/zero of=/tmp/m/fill bs=4k +dd: error writing '/tmp/m/fill': No space left on device +256+0 records in +255+0 records out +1044480 bytes (1.0 MB, 1020 KiB) copied, 0.00234567 s, 445 MB/s +$ busybox sed -i -e 's/.*/bar/' /tmp/m/foo +$ echo $? +0 +$ cat /tmp/m/foo +<empty> + +new behaviour: +$ echo foo > /tmp/m/foo +$ ./busybox sed -i -e 's/.*/bar/' /tmp/m/foo +sed: write error +$ echo $? +4 +$ cat /tmp/m/foo +foo + +function old new delta +sed_main 754 801 +47 +------------------------------------------------------------------------------ +(add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0) Total: 47 bytes + text data bss dec hex filename + 66957 2398 1552 70907 114fb busybox_old + 67004 2398 1552 70954 1152a busybox_unstripped + +Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> +--- + editors/sed.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/editors/sed.c b/editors/sed.c +index 00dde60be..6179c5e80 100644 +--- a/editors/sed.c ++++ b/editors/sed.c +@@ -1648,6 +1648,11 @@ int sed_main(int argc UNUSED_PARAM, char **argv) + fchown(nonstdoutfd, statbuf.st_uid, statbuf.st_gid); + + process_files(); ++ fflush(G.nonstdout); ++ if (ferror(G.nonstdout)) { ++ xfunc_error_retval = 4; /* It's what gnu sed exits with... */ ++ bb_simple_error_msg_and_die(bb_msg_write_error); ++ } + fclose(G.nonstdout); + G.nonstdout = stdout; + |