static analysis, and help to translator
Hello,
Next release is apparently just round corner. This series of changes are results of running clang, smatch and cppcheck. Last four patches has tons of message changes, which translators hopefully appreciate, but made sending a diff feel bit extensive (more than 1000 lines long). If you are interested to check an individual patch quickly have a look of the github web gui.
https://github.com/kerolasa/lelux-utiliteetit/commits/2012wk28
The following changes since commit 2e7035646eb85851171cc2e989bfa858a4f00cd4:
login: close tty before vhangup() (2012-07-12 16:35:01 +0200)
are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git 2012wk28
for you to fetch changes up to 8b59a0c3764fa23aa66cf71bb5334cc23d736c60:
translation: unify file open error messages (2012-07-15 10:39:57 +0200)
----------------------------------------------------------------
Sami Kerola (13):
build-sys: reduce warning noise when compiling with clang
libblkid: remove duplicate entries in symbols lib/pager: minor compiler warning fixes
findmnt: add missing initializer
lib/loopdev: minor bug fix: add missing semicolon
swapon: remove unused variables
utmpdump: remove unused variable
look: remove extra semicolon
fdisk: make if clause easier to read
su: align with howto-usage-function
utmpdump: use help and version output macros
translation: unify stat error messages
translation: unify file open error messages
configure.ac | 28 +++++++++++++++++++++++--- disk-utils/addpart.c | 2 +- disk-utils/delpart.c | 2 +- disk-utils/fdformat.c | 6 +++--- disk-utils/fsck.c | 2 +- disk-utils/fsck.cramfs.c | 6 +++--- disk-utils/fsck.minix.c | 2 +- disk-utils/isosize.c | 2 +- disk-utils/mkfs.bfs.c | 2 +- disk-utils/mkfs.cramfs.c | 6 +++--- disk-utils/mkfs.minix.c | 4 ++-- disk-utils/partx.c | 4 ++-- disk-utils/swaplabel.c | 2 +- fdisks/cfdisk.c | 6 +++--- fdisks/fdisk.c | 41 +++++++++++++++++++------------------ lib/at.c | 2 +- lib/loopdev.c | 2 +- lib/pager.c | 4 +++- lib/path.c | 4 ++-- libblkid/src/blkid.sym | 2 -- login-utils/islocal.c | 3 +-- login-utils/last.c | 2 +- login-utils/su.c | 51 +++++++++++++++++++++++------------------------ login-utils/sulogin.c | 8 ++++---- login-utils/utmpdump.c | 13 ++++++------ login-utils/vipw.c | 2 +- misc-utils/findmnt.c | 42 +++++++++++++++++++------------------- misc-utils/look.c | 2 +- misc-utils/mcookie.c | 4 ++-- misc-utils/namei.c | 2 +- sys-utils/dmesg.c | 4 ++-- sys-utils/eject.c | 4 ++-- sys-utils/fallocate.c | 2 +- sys-utils/fsfreeze.c | 4 ++-- sys-utils/fstrim.c | 4 ++-- sys-utils/hwclock-cmos.c | 2 +- sys-utils/hwclock-rtc.c | 10 +++++----- sys-utils/hwclock.c | 2 +- sys-utils/losetup.c | 2 +- sys-utils/rtcwake.c | 6 +++--- sys-utils/swapon.c | 7 +++---- sys-utils/switch_root.c | 6 +++--- sys-utils/wdctl.c | 2 +- term-utils/mesg.c | 2 +- term-utils/script.c | 6 +++--- term-utils/scriptreplay.c | 4 ++-- term-utils/wall.c | 4 ++-- text-utils/pg.c | 2 +- text-utils/rev.c | 2 +- text-utils/tailf.c | 8 ++++---- text-utils/ul.c | 2 +- 51 files changed, 180 insertions(+), 163 deletions(-)
Signature · 2 lines
Sami Kerola http://www.iki.fi/kerolasa/
Karel Zak
maintainerQuoted 1 line · Sami Kerola
build-sys: reduce warning noise when compiling with clang
.. I spent hour to improve UL_WARN_ADD and after commit and push I found that whole problem could be resolved by an extra -Werror in UL_WARN_ADD implementation.
so the result from CC=clang ./configure is:
checking whether compiler handles -Wextra... yes
checking whether compiler handles -Wno-missing-field-initializers... yes checking whether compiler handles -Wsign-compare... yes checking whether compiler handles -Wtype-limits... yes checking whether compiler handles -Wuninitialized... yes checking whether compiler handles -Werror=sequence-point... yes checking whether compiler handles -Wunused-parameter... yes checking whether compiler handles -fno-common... yes checking whether compiler handles -Wunused-result... no checking whether compiler handles -Wmissing-prototypes... yes checking whether compiler handles -Wunused-variable... yes checking whether compiler handles -Wmissing-parameter-type... no checking whether compiler handles -Wunused-but-set-parameter... no checking whether compiler handles -Wunused-but-set-variable... no checking whether compiler handles -Wredundant-decls... yes
Quoted 3 lines
libblkid: remove duplicate entries in symbols lib/pager: minor compiler warning fixes
findmnt: add missing initializer
Why we need this if code is compiled with -Wno-missing-field-initializers?
It's pretty obvious in C standard how are missing fields are initialized in global and static variables.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 16 lines · Sami Kerola
Hello,
Next release is apparently just round corner. This series of changes are results of running clang, smatch and cppcheck. Last four patches has tons of message changes, which translators hopefully appreciate, but made sending a diff feel bit extensive (more than 1000 lines long). If you are interested to check an individual patch quickly have a look of the github web gui.
https://github.com/kerolasa/lelux-utiliteetit/commits/2012wk28
The following changes since commit
2e7035646eb85851171cc2e989bfa858a4f00cd4:login: close tty before
vhangup()(2012-07-12 16:35:01 +0200)
Quoted 8 lines
are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git2012wk28for you to fetch changes up to
8b59a0c3764fa23aa66cf71bb5334cc23d736c60:translation: unify file open error messages (2012-07-15 10:39:57 +0200)
Sami, this breaks regression test scripts; please be sure to always run them when making general changes across all utils.
Thanks,
Davidlohr
Quoted 69 lines
----------------------------------------------------------------
Sami Kerola (13):
build-sys: reduce warning noise when compiling with clang
libblkid: remove duplicate entries in symbols lib/pager: minor compiler warning fixes
findmnt: add missing initializer
lib/loopdev: minor bug fix: add missing semicolon
swapon: remove unused variables
utmpdump: remove unused variable
look: remove extra semicolon
fdisk: make if clause easier to read
su: align with howto-usage-function
utmpdump: use help and version output macros
translation: unify stat error messages
translation: unify file open error messagesconfigure.ac | 28 +++++++++++++++++++++++--- disk-utils/addpart.c | 2 +- disk-utils/delpart.c | 2 +- disk-utils/fdformat.c | 6 +++--- disk-utils/fsck.c | 2 +- disk-utils/fsck.cramfs.c | 6 +++--- disk-utils/fsck.minix.c | 2 +- disk-utils/isosize.c | 2 +- disk-utils/mkfs.bfs.c | 2 +- disk-utils/mkfs.cramfs.c | 6 +++--- disk-utils/mkfs.minix.c | 4 ++-- disk-utils/partx.c | 4 ++-- disk-utils/swaplabel.c | 2 +- fdisks/cfdisk.c | 6 +++--- fdisks/fdisk.c | 41 +++++++++++++++++++------------------ lib/at.c | 2 +- lib/loopdev.c | 2 +- lib/pager.c | 4 +++- lib/path.c | 4 ++-- libblkid/src/blkid.sym | 2 -- login-utils/islocal.c | 3 +-- login-utils/last.c | 2 +- login-utils/su.c | 51 +++++++++++++++++++++++------------------------ login-utils/sulogin.c | 8 ++++---- login-utils/utmpdump.c | 13 ++++++------ login-utils/vipw.c | 2 +- misc-utils/findmnt.c | 42 +++++++++++++++++++------------------- misc-utils/look.c | 2 +- misc-utils/mcookie.c | 4 ++-- misc-utils/namei.c | 2 +- sys-utils/dmesg.c | 4 ++-- sys-utils/eject.c | 4 ++-- sys-utils/fallocate.c | 2 +- sys-utils/fsfreeze.c | 4 ++-- sys-utils/fstrim.c | 4 ++-- sys-utils/hwclock-cmos.c | 2 +- sys-utils/hwclock-rtc.c | 10 +++++----- sys-utils/hwclock.c | 2 +- sys-utils/losetup.c | 2 +- sys-utils/rtcwake.c | 6 +++--- sys-utils/swapon.c | 7 +++---- sys-utils/switch_root.c | 6 +++--- sys-utils/wdctl.c | 2 +- term-utils/mesg.c | 2 +- term-utils/script.c | 6 +++--- term-utils/scriptreplay.c | 4 ++-- term-utils/wall.c | 4 ++-- text-utils/pg.c | 2 +- text-utils/rev.c | 2 +- text-utils/tailf.c | 8 ++++---- text-utils/ul.c | 2 +- 51 files changed, 180 insertions(+), 163 deletions(-)
Quoted 4 lines · Davidlohr Bueso
Quoted 1 line
translation: unify file open error messages (2012-07-15 10:39:57 +0200)
Sami, this breaks regression test scripts; please be sure to always run them when making general changes across all utils.
Hi Dave et.al.
Good point. I had a look of tests and found couple other things being broken as well, which are fixed in pull below. Could you Dave have look of fdisk test fix? I think I got assumption right, but I really would like to add reviewed-by line.
https://github.com/kerolasa/lelux-utiliteetit/commit/f6d755739df0c48e17e0eb85a485ad1aa4d59bc7
The following changes since commit cc924cc086cf0363f49edd6ce14947acae2dad77:
mkfs.cramfs: fix compiler warning [-Wmissing-prototypes] (2012-07-16
18:57:30 +0200)
are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git test-fixes
for you to fetch changes up to f6d755739df0c48e17e0eb85a485ad1aa4d59bc7:
fdisk: change expected test output (2012-07-17 07:45:36 +0200)
----------------------------------------------------------------
Sami Kerola (3):
tests: partx changed default output format
tests: look: add words file
fdisk: change expected test output
fdisks/fdisk.c | 7 +++++-- tests/expected/fdisk/oddinput | 4 ++-- tests/expected/partx/partx-bsd | 5 +++-- tests/expected/partx/partx-dos+bsd | 9 +++++---- tests/expected/partx/partx-gpt | 11 ++++++----- tests/expected/partx/partx-sgi | 5 +++-- tests/expected/partx/partx-sun | 5 +++-- tests/ts/look/separator | 4 +--- tests/ts/look/words | 3 +++ 9 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 tests/ts/look/words
fdisks/fdisk.c +0 -0
@@ -1761,8 +1761,11 @@ static void
print_partition_table_from_option(char *device, unsigned long sector
int gb;
struct fdisk_context *cxt = fdisk_new_context_from_filename(device,
1); /* read-only */
- if (!cxt)
- err(EXIT_FAILURE, _("cannot open %s"), device);
+ if (!cxt) {
+ if (errno)
+ err(EXIT_FAILURE, _("cannot open %s"), device);
+ errx(EXIT_FAILURE, _("cannot open %s: too small device"), device);
+ }
if (sector_size) /* passed -b option, override autodiscovery */
cxt->phy_sector_size = cxt->sector_size = sector_size;
/* passed CHS option(s), override autodiscovery */
tests/expected/fdisk/oddinput +0 -1
@@ -9,6 +9,6 @@ Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Nonexistant file -lt-fdisk: unable to open _a_file_that_does_not_exist_: No such file
or directory
+lt-fdisk: cannot open _a_file_that_does_not_exist_: No such file or directory
Too small file
-lt-fdisk: unable to open oddinput.toosmall: Success
+lt-fdisk: cannot open oddinput.toosmall: too small device
tests/expected/partx/partx-bsd +3 -2
@@ -1,2 +1,3 @@ -# 1: 7936- 12799 ( 4864 sectors, 2 MB) -# 2: 12544- 16127 ( 3584 sectors, 1 MB) +NR START END SECTORS SIZE NAME UUID + 1 7936 12799 4864 2.4M + 2 12544 16127 3584 1.8M
(quoted diff) +0 -0
b/tests/expected/partx/partx-dos+bsd
index 3242a6c..75cdfe8 100644
tests/expected/partx/partx-dos+bsd +5 -4
@@ -1,4 +1,5 @@ -# 1: 32- 7679 ( 7648 sectors, 3 MB) -# 2: 7680- 16383 ( 8704 sectors, 4 MB) -# 5: 7936- 12799 ( 4864 sectors, 2 MB) -# 6: 12544- 16127 ( 3584 sectors, 1 MB) +NR START END SECTORS SIZE NAME UUID + 1 32 7679 7648 3.8M + 2 7680 16383 8704 4.3M + 5 7936 12799 4864 2.4M + 6 12544 16127 3584 1.8M
tests/expected/partx/partx-gpt +2 -5
@@ -1,5 +1,6 @@ -# 1: 34- 2047 ( 2014 sectors, 1 MB) -# 2: 2048- 4095 ( 2048 sectors, 1 MB) -# 3: 4096- 6143 ( 2048 sectors, 1 MB) -# 4: 6144- 8191 ( 2048 sectors, 1 MB) -# 5: 8192- 10239 ( 2048 sectors, 1 MB) +NR START END SECTORS SIZE NAME UUID + 1 34 2047 2014 1007K ThisIsName
1dcf10bc-637e-4c52-8203-087ae10a820b
+ 2 2048 4095 2048 1M ThisIsOtherName
a1d03a96-7238-46c6-bbb3-789cbe173ec7
+ 3 4096 6143 2048 1M primary
a7101b6c-468c-47df-aff6-cd444d12af61
+ 4 6144 8191 2048 1M primary
afc4950a-f0f1-4add-802c-5957133486d1
+ 5 8192 10239 2048 1M primary
0db0a787-c16b-4886-af3a-fbb97299677c
tests/expected/partx/partx-sgi +3 -2
@@ -1,2 +1,3 @@ -# 1: 63- 1606499 ( 1606437 sectors, 822 MB) -# 2: 1606500- 32129999 ( 30523500 sectors, 15628 MB) +NR START END SECTORS SIZE NAME UUID + 1 63 1606499 1606437 784.4M + 2 1606500 32129999 30523500 14.6G
tests/expected/partx/partx-sun +3 -2
@@ -1,2 +1,3 @@ -# 1: 0- 87379 ( 87380 sectors, 44 MB) -# 2: 87380- 131069 ( 43690 sectors, 22 MB) +NR START END SECTORS SIZE NAME UUID + 1 0 87379 87380 42.7M + 2 87380 131069 43690 21.3M
tests/ts/look/separator +1 -3
@@ -34,8 +34,6 @@ TS_DESC="separator" . $TS_TOPDIR/functions.sh ts_init "$*" -[ -f "/usr/share/dict/words" ] || ts_skip "/usr/share/dict/words not such file" - -$TS_CMD_LOOK apple-pie >> $TS_OUTPUT +$TS_CMD_LOOK apple-pie $TS_TOPDIR/ts/look/words >> $TS_OUTPUT ts_finalize
tests/ts/look/words new file +3 -0
@@ -0,0 +1,3 @@ +apple +apple-pie +oranges
Signature · 2 lines
Sami Kerola http://www.iki.fi/kerolasa/
Quoted 57 lines · Sami Kerola
Quoted 4 lines · Davidlohr Bueso
Quoted 1 line
translation: unify file open error messages (2012-07-15 10:39:57 +0200)
Sami, this breaks regression test scripts; please be sure to always run them when making general changes across all utils.
Hi Dave et.al.
Good point. I had a look of tests and found couple other things being broken as well, which are fixed in pull below. Could you Dave have look of fdisk test fix? I think I got assumption right, but I really would like to add reviewed-by line.
https://github.com/kerolasa/lelux-utiliteetit/commit/f6d755739df0c48e17e0eb85a485ad1aa4d59bc7
The following changes since commit
cc924cc086cf0363f49edd6ce14947acae2dad77:mkfs.cramfs: fix compiler warning [-Wmissing-prototypes] (2012-07-16
18:57:30 +0200)are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.gittest-fixesfor you to fetch changes up to
f6d755739df0c48e17e0eb85a485ad1aa4d59bc7:fdisk: change expected test output (2012-07-17 07:45:36 +0200)
----------------------------------------------------------------
Sami Kerola (3):
tests: partx changed default output format
tests: look: add words file
fdisk: change expected test outputfdisks/fdisk.c | 7 +++++-- tests/expected/fdisk/oddinput | 4 ++-- tests/expected/partx/partx-bsd | 5 +++-- tests/expected/partx/partx-dos+bsd | 9 +++++---- tests/expected/partx/partx-gpt | 11 ++++++----- tests/expected/partx/partx-sgi | 5 +++-- tests/expected/partx/partx-sun | 5 +++-- tests/ts/look/separator | 4 +--- tests/ts/look/words | 3 +++ 9 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 tests/ts/look/wordsfdisks/fdisk.c +0
-0@@ -1761,8 +1761,11 @@ static voidprint_partition_table_from_option(char *device, unsigned long sector
fdisks/fdisk.c +0
-0int gb; struct fdisk_context *cxt = fdisk_new_context_from_filename(device,1); /* read-only */
fdisks/fdisk.c
Quoted 6 lines
fdisks/fdisk.c +4
-2-if (!cxt) -err (EXIT_FAILURE ,_ ("cannot open %s" ), device); +if (!cxt) { +if (errno) +err (EXIT_FAILURE ,_ ("cannot open %s" ), device); +errx (EXIT_FAILURE ,_ ("cannot open %s: too small device" ), device);
I'm currently working on fine grain error handling, so for now, I'd be happy just leaving the cannot open device message, and not worrying about device too small - this isn't very meaningful to the user either, IMHO.
Thanks,
Davidlohr
Quoted 108 lines
fdisks/fdisk.c +1
-0+ }if (sector_size)/* passed -b option, override autodiscovery */ cxt->phy_sector_size = cxt->sector_size = sector_size;/* passed CHS option(s), override autodiscovery */ tests/expected/fdisk/oddinput +0
-1@@ -9,6 +9,6 @@ Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Nonexistant file -lt-fdisk: unable to open _a_file_that_does_not_exist_: No such fileor directory
tests/expected/fdisk/oddinput +2
-1+lt-fdisk: cannot open _a_file_that_does_not_exist_: No such file or directory Too small file -lt-fdisk: unable to open oddinput.toosmall: Success +lt-fdisk: cannot open oddinput.toosmall: too small devicetests/expected/partx/partx-bsd +3
-2@@ -1,2 +1,3 @@ -# 1: 7936- 12799 ( 4864 sectors, 2 MB) -# 2: 12544- 16127 ( 3584 sectors, 1 MB) +NR START END SECTORS SIZE NAME UUID + 1 7936 12799 4864 2.4M + 2 12544 16127 3584 1.8Mtests/expected/partx/partx-dos+bsd +5
-4@@ -1,4 +1,5 @@ -# 1: 32- 7679 ( 7648 sectors, 3 MB) -# 2: 7680- 16383 ( 8704 sectors, 4 MB) -# 5: 7936- 12799 ( 4864 sectors, 2 MB) -# 6: 12544- 16127 ( 3584 sectors, 1 MB) +NR START END SECTORS SIZE NAME UUID + 1 32 7679 7648 3.8M + 2 7680 16383 8704 4.3M + 5 7936 12799 4864 2.4M + 6 12544 16127 3584 1.8Mtests/expected/partx/partx-gpt +2
-5@@ -1,5 +1,6 @@ -# 1: 34- 2047 ( 2014 sectors, 1 MB) -# 2: 2048- 4095 ( 2048 sectors, 1 MB) -# 3: 4096- 6143 ( 2048 sectors, 1 MB) -# 4: 6144- 8191 ( 2048 sectors, 1 MB) -# 5: 8192- 10239 ( 2048 sectors, 1 MB) +NR START END SECTORS SIZE NAME UUID + 1 34 2047 2014 1007K ThisIsName1dcf10bc-637e-4c52-8203-087ae10a820b
+ 2 2048 4095 2048 1M ThisIsOtherName
a1d03a96-7238-46c6-bbb3-789cbe173ec7
+ 3 4096 6143 2048 1M primary
a7101b6c-468c-47df-aff6-cd444d12af61
+ 4 6144 8191 2048 1M primary
afc4950a-f0f1-4add-802c-5957133486d1
+ 5 8192 10239 2048 1M primary
0db0a787-c16b-4886-af3a-fbb97299677ctests/expected/partx/partx-sgi +3
-2@@ -1,2 +1,3 @@ -# 1: 63- 1606499 ( 1606437 sectors, 822 MB) -# 2: 1606500- 32129999 ( 30523500 sectors, 15628 MB) +NR START END SECTORS SIZE NAME UUID + 1 63 1606499 1606437 784.4M + 2 1606500 32129999 30523500 14.6Gtests/expected/partx/partx-sun +3
-2@@ -1,2 +1,3 @@ -# 1: 0- 87379 ( 87380 sectors, 44 MB) -# 2: 87380- 131069 ( 43690 sectors, 22 MB) +NR START END SECTORS SIZE NAME UUID + 1 0 87379 87380 42.7M + 2 87380 131069 43690 21.3Mtests/ts/look/separator +1
-3@@ -34,8 +34,6 @@ TS_DESC="separator" . $TS_TOPDIR/functions.sh ts_init "$*" -[ -f "/usr/share/dict/words" ] || ts_skip "/usr/share/dict/words not such file" - -$TS_CMD_LOOK apple-pie >> $TS_OUTPUT +$TS_CMD_LOOK apple-pie $TS_TOPDIR/ts/look/words >> $TS_OUTPUT ts_finalizetests/ts/look/words new file +3
-0@@ -0,0 +1,3 @@ +apple +apple-pie +oranges
Quoted 4 lines · Davidlohr Bueso
I'm currently working on fine grain error handling, so for now, I'd be happy just leaving the cannot open device message, and not worrying about device too small - this isn't very meaningful to the user either, IMHO.
Hi Dave,
Sounds reasonable. I changed the commit to change as little as possible while making test to pass.
oops I meant
https://github.com/kerolasa/lelux-utiliteetit/commit/9522db63ffce346188d90b6cecde7c3ce6ee799c
Signature · 2 lines
Sami Kerola http://www.iki.fi/kerolasa/
Quoted 6 lines · Sami Kerola
Quoted 4 lines · Davidlohr Bueso
I'm currently working on fine grain error handling, so for now, I'd be happy just leaving the cannot open device message, and not worrying about device too small - this isn't very meaningful to the user either, IMHO.
Quoted 6 lines
Hi Dave,
Sounds reasonable. I changed the commit to change as little as possible while making test to pass.
LOL
Quoted 5 lines
oops I meant
https://github.com/kerolasa/lelux-utiliteetit/commit/9522db63ffce346188d90b6cecde7c3ce6ee799c
Looks good - although I will be redoing the regression tests as new error messages will appear. I don't know if it's worth applying the patch as it will be overwritten any way.
Thanks,
Davidlohr
Quoted 11 lines · Sami Kerola
libblkid: remove duplicate entries in symbols lib/pager: minor compiler warning fixes lib/loopdev: minor bug fix: add missing semicolon
swapon: remove unused variables
utmpdump: remove unused variable
look: remove extra semicolon
fdisk: make if clause easier to read
su: align with howto-usage-function
utmpdump: use help and version output macros
translation: unify stat error messages
translation: unify file open error messages
Applied,
Quoted 2 lines
build-sys: reduce warning noise when compiling with clang
findmnt: add missing initializer
not applied. Thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com