util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pull] static analysis, and help to translator
@ 2012-07-15 20:40 Sami Kerola
  2012-07-16 15:51 ` Karel Zak
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sami Kerola @ 2012-07-15 20:40 UTC (permalink / raw)
  To: util-linux

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(-)

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-15 20:40 [pull] static analysis, and help to translator Sami Kerola
@ 2012-07-16 15:51 ` Karel Zak
  2012-07-16 16:27 ` Karel Zak
  2012-07-16 17:44 ` Davidlohr Bueso
  2 siblings, 0 replies; 8+ messages in thread
From: Karel Zak @ 2012-07-16 15:51 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On Sun, Jul 15, 2012 at 10:40:30PM +0200, Sami Kerola wrote:
>       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



>       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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-15 20:40 [pull] static analysis, and help to translator Sami Kerola
  2012-07-16 15:51 ` Karel Zak
@ 2012-07-16 16:27 ` Karel Zak
  2012-07-16 17:44 ` Davidlohr Bueso
  2 siblings, 0 replies; 8+ messages in thread
From: Karel Zak @ 2012-07-16 16:27 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On Sun, Jul 15, 2012 at 10:40:30PM +0200, Sami Kerola wrote:
>       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,

>       build-sys: reduce warning noise when compiling with clang
>       findmnt: add missing initializer

 not applied. Thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-15 20:40 [pull] static analysis, and help to translator Sami Kerola
  2012-07-16 15:51 ` Karel Zak
  2012-07-16 16:27 ` Karel Zak
@ 2012-07-16 17:44 ` Davidlohr Bueso
  2012-07-17  6:06   ` Sami Kerola
  2 siblings, 1 reply; 8+ messages in thread
From: Davidlohr Bueso @ 2012-07-16 17:44 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On Sun, 2012-07-15 at 22:40 +0200, Sami Kerola wrote:
> 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, this breaks regression test scripts; please be sure to always run
them when making general changes across all utils.

Thanks,
Davidlohr

> ----------------------------------------------------------------
> 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(-)
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-16 17:44 ` Davidlohr Bueso
@ 2012-07-17  6:06   ` Sami Kerola
  2012-07-17 10:03     ` Davidlohr Bueso
  0 siblings, 1 reply; 8+ messages in thread
From: Sami Kerola @ 2012-07-17  6:06 UTC (permalink / raw)
  To: dave; +Cc: util-linux

On Mon, Jul 16, 2012 at 7:44 PM, Davidlohr Bueso <dave@gnu.org> wrote:
>>   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

diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index 32b6de9..55fd751 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -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 */
diff --git a/tests/expected/fdisk/oddinput b/tests/expected/fdisk/oddinput
index d90866b..bd70066 100644
--- a/tests/expected/fdisk/oddinput
+++ b/tests/expected/fdisk/oddinput
@@ -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
diff --git a/tests/expected/partx/partx-bsd b/tests/expected/partx/partx-bsd
index d4be5c5..15568c4 100644
--- a/tests/expected/partx/partx-bsd
+++ b/tests/expected/partx/partx-bsd
@@ -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
diff --git a/tests/expected/partx/partx-dos+bsd
b/tests/expected/partx/partx-dos+bsd
index 3242a6c..75cdfe8 100644
--- a/tests/expected/partx/partx-dos+bsd
+++ b/tests/expected/partx/partx-dos+bsd
@@ -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
diff --git a/tests/expected/partx/partx-gpt b/tests/expected/partx/partx-gpt
index 0a1d491..c941f36 100644
--- a/tests/expected/partx/partx-gpt
+++ b/tests/expected/partx/partx-gpt
@@ -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
diff --git a/tests/expected/partx/partx-sgi b/tests/expected/partx/partx-sgi
index 469d442..ba357e0 100644
--- a/tests/expected/partx/partx-sgi
+++ b/tests/expected/partx/partx-sgi
@@ -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
diff --git a/tests/expected/partx/partx-sun b/tests/expected/partx/partx-sun
index d957f58..e69fdb1 100644
--- a/tests/expected/partx/partx-sun
+++ b/tests/expected/partx/partx-sun
@@ -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
diff --git a/tests/ts/look/separator b/tests/ts/look/separator
index 17d68db..51e96c9 100755
--- a/tests/ts/look/separator
+++ b/tests/ts/look/separator
@@ -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

diff --git a/tests/ts/look/words b/tests/ts/look/words
new file mode 100644
index 0000000..b67ba9a
--- /dev/null
+++ b/tests/ts/look/words
@@ -0,0 +1,3 @@
+apple
+apple-pie
+oranges

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-17  6:06   ` Sami Kerola
@ 2012-07-17 10:03     ` Davidlohr Bueso
  2012-07-17 12:03       ` Sami Kerola
  0 siblings, 1 reply; 8+ messages in thread
From: Davidlohr Bueso @ 2012-07-17 10:03 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On Tue, 2012-07-17 at 08:06 +0200, Sami Kerola wrote:
> On Mon, Jul 16, 2012 at 7:44 PM, Davidlohr Bueso <dave@gnu.org> wrote:
> >>   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
> 
> diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
> index 32b6de9..55fd751 100644
> --- a/fdisks/fdisk.c
> +++ b/fdisks/fdisk.c
> @@ -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);

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

> +	}
>  	if (sector_size)  /* passed -b option, override autodiscovery */
>  		cxt->phy_sector_size = cxt->sector_size = sector_size;
>  	/* passed CHS option(s), override autodiscovery */
> diff --git a/tests/expected/fdisk/oddinput b/tests/expected/fdisk/oddinput
> index d90866b..bd70066 100644
> --- a/tests/expected/fdisk/oddinput
> +++ b/tests/expected/fdisk/oddinput
> @@ -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
> diff --git a/tests/expected/partx/partx-bsd b/tests/expected/partx/partx-bsd
> index d4be5c5..15568c4 100644
> --- a/tests/expected/partx/partx-bsd
> +++ b/tests/expected/partx/partx-bsd
> @@ -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
> diff --git a/tests/expected/partx/partx-dos+bsd
> b/tests/expected/partx/partx-dos+bsd
> index 3242a6c..75cdfe8 100644
> --- a/tests/expected/partx/partx-dos+bsd
> +++ b/tests/expected/partx/partx-dos+bsd
> @@ -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
> diff --git a/tests/expected/partx/partx-gpt b/tests/expected/partx/partx-gpt
> index 0a1d491..c941f36 100644
> --- a/tests/expected/partx/partx-gpt
> +++ b/tests/expected/partx/partx-gpt
> @@ -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
> diff --git a/tests/expected/partx/partx-sgi b/tests/expected/partx/partx-sgi
> index 469d442..ba357e0 100644
> --- a/tests/expected/partx/partx-sgi
> +++ b/tests/expected/partx/partx-sgi
> @@ -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
> diff --git a/tests/expected/partx/partx-sun b/tests/expected/partx/partx-sun
> index d957f58..e69fdb1 100644
> --- a/tests/expected/partx/partx-sun
> +++ b/tests/expected/partx/partx-sun
> @@ -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
> diff --git a/tests/ts/look/separator b/tests/ts/look/separator
> index 17d68db..51e96c9 100755
> --- a/tests/ts/look/separator
> +++ b/tests/ts/look/separator
> @@ -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
> 
> diff --git a/tests/ts/look/words b/tests/ts/look/words
> new file mode 100644
> index 0000000..b67ba9a
> --- /dev/null
> +++ b/tests/ts/look/words
> @@ -0,0 +1,3 @@
> +apple
> +apple-pie
> +oranges
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-17 10:03     ` Davidlohr Bueso
@ 2012-07-17 12:03       ` Sami Kerola
  2012-07-17 12:11         ` Davidlohr Bueso
  0 siblings, 1 reply; 8+ messages in thread
From: Sami Kerola @ 2012-07-17 12:03 UTC (permalink / raw)
  To: dave; +Cc: util-linux

On Tue, Jul 17, 2012 at 12:03 PM, Davidlohr Bueso <dave@gnu.org> wrote:
> 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.

http://i.imgur.com/wGUTG.gif

oops I meant

https://github.com/kerolasa/lelux-utiliteetit/commit/9522db63ffce346188d90b6cecde7c3ce6ee799c

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pull] static analysis, and help to translator
  2012-07-17 12:03       ` Sami Kerola
@ 2012-07-17 12:11         ` Davidlohr Bueso
  0 siblings, 0 replies; 8+ messages in thread
From: Davidlohr Bueso @ 2012-07-17 12:11 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On Tue, 2012-07-17 at 14:03 +0200, Sami Kerola wrote:
> On Tue, Jul 17, 2012 at 12:03 PM, Davidlohr Bueso <dave@gnu.org> wrote:
> > 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.
> 
> http://i.imgur.com/wGUTG.gif

LOL

> 
> 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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-17 12:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-15 20:40 [pull] static analysis, and help to translator Sami Kerola
2012-07-16 15:51 ` Karel Zak
2012-07-16 16:27 ` Karel Zak
2012-07-16 17:44 ` Davidlohr Bueso
2012-07-17  6:06   ` Sami Kerola
2012-07-17 10:03     ` Davidlohr Bueso
2012-07-17 12:03       ` Sami Kerola
2012-07-17 12:11         ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).