Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH 0/6] minor last minute fixes for v2.30
@ 2017-06-01  1:08 Ruediger Meier
  2017-06-01  1:08 ` [PATCH 1/6] tests: grep's short option -A is more portable Ruediger Meier
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This is all non-critical, in doubt skip it.

Linux User (1):
  tests: use stdbuf when stderr and stdout is randomly ordered

Ruediger Meier (5):
  tests: grep's short option -A is more portable
  tests: avoid diff of diffs
  build-sys: fix library order when linking
  tests: handle non glibc error message for fallocate
  misc: fix some warnings

 lib/Makemodule.am                      |  2 +-
 lib/plymouth-ctrl.c                    |  3 ++-
 libblkid/samples/Makemodule.am         |  8 ++++----
 libfdisk/src/Makemodule.am             |  2 +-
 libmount/src/Makemodule.am             |  2 +-
 libsmartcols/samples/Makemodule.am     |  2 +-
 libuuid/src/Makemodule.am              |  2 +-
 login-utils/last.c                     |  2 +-
 misc-utils/test_uuidd.c                | 10 +++++-----
 sys-utils/hwclock.h                    |  1 +
 sys-utils/prlimit.c                    |  4 ++--
 tests/expected/misc/swaplabel          |  2 +-
 tests/expected/rename/exit_codes       |  2 +-
 tests/expected/utmp/utmpdump-subsecond |  7 +++----
 tests/ts/ipcs/headers                  | 26 +++++++++++++-------------
 tests/ts/misc/fallocate                |  5 ++---
 tests/ts/misc/swaplabel                |  3 ++-
 tests/ts/rename/exit_codes             |  3 ++-
 tests/ts/utmp/utmpdump-subsecond       |  4 +---
 19 files changed, 45 insertions(+), 45 deletions(-)

-- 
1.8.5.6


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

* [PATCH 1/6] tests: grep's short option -A is more portable
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
@ 2017-06-01  1:08 ` Ruediger Meier
  2017-06-01  1:08 ` [PATCH 2/6] tests: avoid diff of diffs Ruediger Meier
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Noticed on Alpine Linux/busybox.

Reported-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/ts/ipcs/headers | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/ts/ipcs/headers b/tests/ts/ipcs/headers
index 5089ea5..475ed56 100755
--- a/tests/ts/ipcs/headers
+++ b/tests/ts/ipcs/headers
@@ -24,35 +24,35 @@ ts_init "$*"
 ts_check_test_command "$TS_CMD_IPCS"
 
 ts_log "test: shm headers"
-$TS_CMD_IPCS -m -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -m -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -m -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -m -t | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -m -p | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -m -c | grep -A1 "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -m -l | grep "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -m -u | grep "^---"  >> $TS_OUTPUT
 echo >> $TS_OUTPUT
 
 ts_log "test: mesg headers"
-$TS_CMD_IPCS -q -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -q -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -q -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -q -t | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -q -p | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -q -c | grep -A1 "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -q -l | grep  "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -q -u | grep  "^---"  >> $TS_OUTPUT
 echo >> $TS_OUTPUT
 
 ts_log "test: sem headers"
-$TS_CMD_IPCS -s -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -s -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -s -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -s -t | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -s -p | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -s -c | grep -A1 "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -s -l | grep  "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -s -u | grep  "^---"  >> $TS_OUTPUT
 echo >> $TS_OUTPUT
 
 ts_log "test: all headers"
-$TS_CMD_IPCS -a | grep --after-context=1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -a | grep -A1 "^---"  >> $TS_OUTPUT
 
-$TS_CMD_IPCS -a -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -a -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
-$TS_CMD_IPCS -a -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -a -t | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -a -p | grep -A1 "^---"  >> $TS_OUTPUT
+$TS_CMD_IPCS -a -c | grep -A1 "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -a -l | grep "^---"  >> $TS_OUTPUT
 $TS_CMD_IPCS -a -u | grep "^---"  >> $TS_OUTPUT
 
-- 
1.8.5.6


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

* [PATCH 2/6] tests: avoid diff of diffs
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
  2017-06-01  1:08 ` [PATCH 1/6] tests: grep's short option -A is more portable Ruediger Meier
@ 2017-06-01  1:08 ` Ruediger Meier
  2017-06-01  1:08 ` [PATCH 3/6] build-sys: fix library order when linking Ruediger Meier
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Certain diff implementations do not produce comparable output.

Noticed on Alpine Linux/busybox.

CC: Sami Kerola <kerolasa@iki.fi>
Reported-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/expected/utmp/utmpdump-subsecond | 7 +++----
 tests/ts/utmp/utmpdump-subsecond       | 4 +---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/tests/expected/utmp/utmpdump-subsecond b/tests/expected/utmp/utmpdump-subsecond
index 9ec40da..649ab7f 100644
--- a/tests/expected/utmp/utmpdump-subsecond
+++ b/tests/expected/utmp/utmpdump-subsecond
@@ -1,5 +1,4 @@
 last 9 is expected to disappear in conversion
-3c3
-< [0] [00000] [ts/0] [nonvalid] [foo         ] [zero                ] [0.0.0.0        ] [2013-08-28T12:00:00,123456789+0000]
----
-> [0] [00000] [ts/0] [nonvalid] [foo         ] [zero                ] [0.0.0.0        ] [2013-08-28T12:00:00,12345678+0000]
+[7] [00010] [ipv6] [IPv6    ] [root        ] [dns-server          ] [2001:503:ba3e::2:30] [2013-08-28T20:30:40,123456+0000]
+[8] [00011] [ipv6] [IPv6    ] [root        ] [dns-server          ] [2001:503:ba3e::2:30] [2013-08-28T20:40:50,999999+0000]
+[0] [00000] [ts/0] [nonvalid] [foo         ] [zero                ] [0.0.0.0        ] [2013-08-28T12:00:00,12345678+0000]
diff --git a/tests/ts/utmp/utmpdump-subsecond b/tests/ts/utmp/utmpdump-subsecond
index f753a6d..49dc9d6 100755
--- a/tests/ts/utmp/utmpdump-subsecond
+++ b/tests/ts/utmp/utmpdump-subsecond
@@ -22,12 +22,10 @@ ts_init "$*"
 ts_check_test_command "$TS_CMD_UTMPDUMP"
 
 OUT_BIN=${TS_OUTDIR}/${TS_TESTNAME}.bin
-OUT_TXT=${TS_OUTDIR}/${TS_TESTNAME}.txt
 
 echo "last 9 is expected to disappear in conversion" > $TS_OUTPUT
 $TS_CMD_UTMPDUMP -r $TS_SELF/subsec > $OUT_BIN 2>/dev/null
-$TS_CMD_UTMPDUMP $OUT_BIN > $OUT_TXT 2>/dev/null
-diff $TS_SELF/subsec $OUT_TXT >> $TS_OUTPUT 2>&1
+$TS_CMD_UTMPDUMP $OUT_BIN >> $TS_OUTPUT 2>/dev/null
 
 rm -f "$OUT_BIN" "$OUT_TXT"
 
-- 
1.8.5.6


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

* [PATCH 3/6] build-sys: fix library order when linking
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
  2017-06-01  1:08 ` [PATCH 1/6] tests: grep's short option -A is more portable Ruediger Meier
  2017-06-01  1:08 ` [PATCH 2/6] tests: avoid diff of diffs Ruediger Meier
@ 2017-06-01  1:08 ` Ruediger Meier
  2017-06-01  1:08 ` [PATCH 4/6] tests: use stdbuf when stderr and stdout is randomly ordered Ruediger Meier
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

We got some errors on Alpine Linux where $LTLIBINTL is non-empty:

./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file':
lib/blkdev.c:282: undefined reference to `libintl_gettext
collect2: error: ld returned 1 exit status

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 lib/Makemodule.am                  | 2 +-
 libblkid/samples/Makemodule.am     | 8 ++++----
 libfdisk/src/Makemodule.am         | 2 +-
 libmount/src/Makemodule.am         | 2 +-
 libsmartcols/samples/Makemodule.am | 2 +-
 libuuid/src/Makemodule.am          | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 8909f92..82fefba 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -104,7 +104,7 @@ test_blkdev_LDADD = $(LDADD) libcommon.la
 
 test_ismounted_SOURCES = lib/ismounted.c
 test_ismounted_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_ISMOUNTED
-test_ismounted_LDADD = $(LDADD) libcommon.la
+test_ismounted_LDADD = libcommon.la $(LDADD)
 
 test_mangle_SOURCES = lib/mangle.c
 test_mangle_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_MANGLE
diff --git a/libblkid/samples/Makemodule.am b/libblkid/samples/Makemodule.am
index e14d13f..dd05fc9 100644
--- a/libblkid/samples/Makemodule.am
+++ b/libblkid/samples/Makemodule.am
@@ -6,17 +6,17 @@ check_PROGRAMS += \
 	sample-topology
 
 sample_mkfs_SOURCES = libblkid/samples/mkfs.c
-sample_mkfs_LDADD = $(LDADD) libblkid.la
+sample_mkfs_LDADD = libblkid.la $(LDADD)
 sample_mkfs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
 
 sample_partitions_SOURCES = libblkid/samples/partitions.c
-sample_partitions_LDADD = $(LDADD) libblkid.la
+sample_partitions_LDADD = libblkid.la $(LDADD)
 sample_partitions_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
 
 sample_superblocks_SOURCES = libblkid/samples/superblocks.c
-sample_superblocks_LDADD = $(LDADD) libblkid.la
+sample_superblocks_LDADD = libblkid.la $(LDADD)
 sample_superblocks_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
 
 sample_topology_SOURCES = libblkid/samples/topology.c
-sample_topology_LDADD = $(LDADD) libblkid.la
+sample_topology_LDADD = libblkid.la $(LDADD)
 sample_topology_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
diff --git a/libfdisk/src/Makemodule.am b/libfdisk/src/Makemodule.am
index e3baf90..9ebfa65 100644
--- a/libfdisk/src/Makemodule.am
+++ b/libfdisk/src/Makemodule.am
@@ -78,7 +78,7 @@ check_PROGRAMS += \
 
 libfdisk_tests_cflags  = -DTEST_PROGRAM $(libfdisk_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
 libfdisk_tests_ldflags = libuuid.la -static
-libfdisk_tests_ldadd   = $(LDADD) libfdisk.la $(UUID_LIBS)
+libfdisk_tests_ldadd   = libfdisk.la $(LDADD) $(UUID_LIBS)
 
 if BUILD_LIBBLKID
 libfdisk_tests_ldflags += libblkid.la
diff --git a/libmount/src/Makemodule.am b/libmount/src/Makemodule.am
index 8c5ef08..af4a921 100644
--- a/libmount/src/Makemodule.am
+++ b/libmount/src/Makemodule.am
@@ -89,7 +89,7 @@ endif
 
 libmount_tests_cflags  = -DTEST_PROGRAM $(libmount_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
 libmount_tests_ldflags = libblkid.la -static
-libmount_tests_ldadd   = $(LDADD) libmount.la $(UUID_LIBS) $(REALTIME_LIBS)
+libmount_tests_ldadd   = libmount.la $(LDADD) $(UUID_LIBS) $(REALTIME_LIBS)
 
 if HAVE_SELINUX
 libmount_tests_ldadd += $(SELINUX_LIBS)
diff --git a/libsmartcols/samples/Makemodule.am b/libsmartcols/samples/Makemodule.am
index 0a54abb..644ac12 100644
--- a/libsmartcols/samples/Makemodule.am
+++ b/libsmartcols/samples/Makemodule.am
@@ -8,7 +8,7 @@ check_PROGRAMS += \
 
 sample_scols_cflags = $(AM_CFLAGS) $(NO_UNUSED_WARN_CFLAGS) \
                       -I$(ul_libsmartcols_incdir)
-sample_scols_ldadd = $(LDADD) libsmartcols.la
+sample_scols_ldadd = libsmartcols.la $(LDADD)
 
 if HAVE_OPENAT
 check_PROGRAMS += sample-scols-tree
diff --git a/libuuid/src/Makemodule.am b/libuuid/src/Makemodule.am
index d3fc811..f1de0f1 100644
--- a/libuuid/src/Makemodule.am
+++ b/libuuid/src/Makemodule.am
@@ -1,7 +1,7 @@
 
 check_PROGRAMS += test_uuid_parser
 test_uuid_parser_SOURCES = libuuid/src/test_uuid.c
-test_uuid_parser_LDADD = $(LDADD) libuuid.la $(SOCKET_LIBS)
+test_uuid_parser_LDADD = libuuid.la $(SOCKET_LIBS) $(LDADD)
 test_uuid_parser_CFLAGS = $(AM_CFLAGS) -I$(ul_libuuid_incdir)
 
 # includes
-- 
1.8.5.6


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

* [PATCH 4/6] tests: use stdbuf when stderr and stdout is randomly ordered
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
                   ` (2 preceding siblings ...)
  2017-06-01  1:08 ` [PATCH 3/6] build-sys: fix library order when linking Ruediger Meier
@ 2017-06-01  1:08 ` Ruediger Meier
  2017-06-01  1:08 ` [PATCH 5/6] tests: handle non glibc error message for fallocate Ruediger Meier
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux

From: Linux User <rudi@zappa.l.ga-group.nl>

glibc seems to flush stdout before stderr.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/expected/misc/swaplabel    | 2 +-
 tests/expected/rename/exit_codes | 2 +-
 tests/ts/misc/swaplabel          | 3 ++-
 tests/ts/rename/exit_codes       | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/expected/misc/swaplabel b/tests/expected/misc/swaplabel
index 172f876..790a28c 100644
--- a/tests/expected/misc/swaplabel
+++ b/tests/expected/misc/swaplabel
@@ -1,7 +1,7 @@
 mkswap: error: swap area needs to be at least 10 pages
 mkswap: <swapfile>: insecure permissions <perm>, 0600 suggested.
-mkswap: Label was truncated.
 Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
+mkswap: Label was truncated.
 LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
 LABEL: 1234567890abcde
 UUID:  12345678-abcd-abcd-abcd-1234567890ab
diff --git a/tests/expected/rename/exit_codes b/tests/expected/rename/exit_codes
index c577817..3d53010 100644
--- a/tests/expected/rename/exit_codes
+++ b/tests/expected/rename/exit_codes
@@ -2,6 +2,6 @@ RENAME_EXIT_NOTHING: 4
 `rename_exit_codes.1' -> `rename_exit_values.1'
 `rename_exit_codes.2' -> `rename_exit_values.2'
 EXIT_SUCCESS: 0
-rename: rename_exit_values.2: rename to rename_exit_codes.2 failed: Is a directory
 `rename_exit_values.1' -> `rename_exit_codes.1'
+rename: rename_exit_values.2: rename to rename_exit_codes.2 failed: Is a directory
 RENAME_EXIT_SOMEOK: 2
diff --git a/tests/ts/misc/swaplabel b/tests/ts/misc/swaplabel
index 6463045..f934b21 100755
--- a/tests/ts/misc/swaplabel
+++ b/tests/ts/misc/swaplabel
@@ -20,6 +20,7 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_MKSWAP"
 ts_check_test_command "$TS_CMD_SWAPLABEL"
+ts_check_prog "stdbuf"
 
 # fallocate does not work on most file systems
 function fallocate_or_skip()
@@ -49,7 +50,7 @@ $TS_CMD_MKSWAP \
 
 rm -f $IMAGE
 fallocate_or_skip $MIN_SWAP_SIZE $IMAGE
-$TS_CMD_MKSWAP \
+stdbuf -oL -eL $TS_CMD_MKSWAP \
 	--label 1234567890abcdef \
 	--uuid 12345678-abcd-abcd-abcd-1234567890ab \
 	$IMAGE 2>&1 |\
diff --git a/tests/ts/rename/exit_codes b/tests/ts/rename/exit_codes
index 3702816..3d46120 100755
--- a/tests/ts/rename/exit_codes
+++ b/tests/ts/rename/exit_codes
@@ -22,6 +22,7 @@ TS_DESC="exit codes"
 ts_init "$*"
 
 ts_check_test_command "$TS_CMD_RENAME"
+ts_check_prog "stdbuf"
 ts_cd "$TS_OUTDIR"
 
 touch rename_exit_codes.{1..2}
@@ -32,7 +33,7 @@ $TS_CMD_RENAME -v codes values rename_exit_codes.? >> $TS_OUTPUT 2>&1
 echo "EXIT_SUCCESS: $?" >> $TS_OUTPUT
 
 mkdir rename_exit_codes.2
-$TS_CMD_RENAME -v values codes rename_exit_values.? >> $TS_OUTPUT 2>&1
+stdbuf -oL -eL $TS_CMD_RENAME -v values codes rename_exit_values.? >> $TS_OUTPUT 2>&1
 echo "RENAME_EXIT_SOMEOK: $?" >> $TS_OUTPUT
 
 rmdir rename_exit_codes.2
-- 
1.8.5.6


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

* [PATCH 5/6] tests: handle non glibc error message for fallocate
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
                   ` (3 preceding siblings ...)
  2017-06-01  1:08 ` [PATCH 4/6] tests: use stdbuf when stderr and stdout is randomly ordered Ruediger Meier
@ 2017-06-01  1:08 ` Ruediger Meier
  2017-06-01  1:08 ` [PATCH 6/6] misc: fix some warnings Ruediger Meier
  2017-06-01  7:52 ` [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
  6 siblings, 0 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/ts/misc/fallocate | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/ts/misc/fallocate b/tests/ts/misc/fallocate
index e938abb..b37d025 100755
--- a/tests/ts/misc/fallocate
+++ b/tests/ts/misc/fallocate
@@ -30,9 +30,8 @@ else
 	# fs type of $TS_OUTDIR, could be used to skip this test early
 	fs_type=$(${TS_CMD_FINDMNT} -n -o FSTYPE -T ${TS_OUTDIR})
 
-	test "$(<$TS_OUTPUT)" \
-	     = "fallocate: fallocate failed: Operation not supported" \
-	&& ts_skip "'${fs_type}' not supported"
+	grep -qi "fallocate: fallocate failed:.*not supported" $TS_OUTPUT \
+		&& ts_skip "'${fs_type}' not supported"
 fi
 
 rm -f $IMAGE
-- 
1.8.5.6


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

* [PATCH 6/6] misc: fix some warnings
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
                   ` (4 preceding siblings ...)
  2017-06-01  1:08 ` [PATCH 5/6] tests: handle non glibc error message for fallocate Ruediger Meier
@ 2017-06-01  1:08 ` Ruediger Meier
  2017-06-01 18:50   ` J William Piggott
  2017-06-01  7:52 ` [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
  6 siblings, 1 reply; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  1:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

sys-utils/prlimit.c: In function 'do_prlimit':
sys-utils/prlimit.c:367:16: warning: format '%ju' expects argument of type 'uintmax_t', but argument 2 has type 'rlim_t {aka long long unsigned int}' [-Wformat=]
     printf("<%ju", new->rlim_cur);

lib/plymouth-ctrl.c: In function 'open_un_socket_and_connect':
lib/plymouth-ctrl.c:88:20: warning: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
  ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
                    ^
In file included from lib/plymouth-ctrl.c:35:0:
/usr/include/sys/socket.h:314:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
 int connect (int, const struct sockaddr *, socklen_t);

login-utils/last.c: In function 'list':
login-utils/last.c:506:54: warning: pointer targets in passing argument 4 of 'dns_lookup' differ in signedness [-Wpointer-sign]
   r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6);
                                                      ^
login-utils/last.c:291:12: note: expected 'int32_t * {aka int *}' but argument is of type 'unsigned int *'
 static int dns_lookup(char *result, int size, int useip, int32_t *a)
            ^~~~~~~~~~

In file included from sys-utils/hwclock-cmos.c:92:0:
sys-utils/hwclock.h:67:32: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
 extern double time_diff(struct timeval subtrahend, struct timeval subtractor);

misc-utils/test_uuidd.c: In function 'create_nthreads':
misc-utils/test_uuidd.c:187:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
        proc->pid, (int) th->tid, th->index));

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 lib/plymouth-ctrl.c     |  3 ++-
 login-utils/last.c      |  2 +-
 misc-utils/test_uuidd.c | 10 +++++-----
 sys-utils/hwclock.h     |  1 +
 sys-utils/prlimit.c     |  4 ++--
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c
index 75d8b93..0e60341 100644
--- a/lib/plymouth-ctrl.c
+++ b/lib/plymouth-ctrl.c
@@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
 	 * Please note that the PLYMOUTH_SOCKET_PATH has a
 	 * leading NULL byte to mark it as an abstract socket
 	 */
-	ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
+	ret = connect(fd, (const struct sockaddr *) &su,
+	              offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
 	if (ret < 0) {
 		if (errno != ECONNREFUSED)
 			warnx(_("cannot connect on UNIX socket"));
diff --git a/login-utils/last.c b/login-utils/last.c
index 679ea6c..f93ec7f 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -503,7 +503,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t
 	 */
 	r = -1;
 	if (ctl->usedns || ctl->useip)
-		r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6);
+		r = dns_lookup(domain, sizeof(domain), ctl->useip, (int32_t*)p->ut_addr_v6);
 	if (r < 0) {
 		size_t sz = sizeof(p->ut_host);
 
diff --git a/misc-utils/test_uuidd.c b/misc-utils/test_uuidd.c
index 73cc90a..9883cbf 100644
--- a/misc-utils/test_uuidd.c
+++ b/misc-utils/test_uuidd.c
@@ -183,8 +183,8 @@ static void create_nthreads(process_t *proc, size_t index)
 			break;
 		}
 
-		LOG(2, (stderr, "%d: started thread [tid=%d,index=%zu]\n",
-		     proc->pid, (int) th->tid, th->index));
+		LOG(2, (stderr, "%d: started thread [tid=%jd,index=%zu]\n",
+		     proc->pid, (intmax_t) th->tid, th->index));
 		index += nobjects;
 		ncreated++;
 	}
@@ -203,8 +203,8 @@ static void create_nthreads(process_t *proc, size_t index)
 			err(EXIT_FAILURE, "pthread_join failed");
 		}
 
-		LOG(2, (stderr, "%d: thread exited [tid=%d,return=%d]\n",
-		     proc->pid, (int) th->tid, th->retval));
+		LOG(2, (stderr, "%d: thread exited [tid=%jd,return=%d]\n",
+		     proc->pid, (intmax_t) th->tid, th->retval));
 	}
 }
 
@@ -256,7 +256,7 @@ static void object_dump(size_t idx, object_t *obj)
 	fprintf(stderr, "  uuid:    <%s>\n", p);
 	fprintf(stderr, "  idx:     %zu\n", obj->idx);
 	fprintf(stderr, "  process: %d\n", (int) obj->pid);
-	fprintf(stderr, "  thread:  %d\n", (int) obj->tid);
+	fprintf(stderr, "  thread:  %jd\n", (intmax_t) obj->tid);
 	fprintf(stderr, "}\n");
 }
 
diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h
index 7d2cc45..f3f76a6 100644
--- a/sys-utils/hwclock.h
+++ b/sys-utils/hwclock.h
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/time.h>
 #include <time.h>
 
 #include "c.h"
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index a62d457..afd1928 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -364,12 +364,12 @@ static void do_prlimit(struct list_head *lims)
 			if (new->rlim_cur == RLIM_INFINITY)
 				printf("<%s", _("unlimited"));
 			else
-				printf("<%ju", new->rlim_cur);
+				printf("<%ju", (uintmax_t)new->rlim_cur);
 
 			if (new->rlim_max == RLIM_INFINITY)
 				printf(":%s>\n", _("unlimited"));
 			else
-				printf(":%ju>\n", new->rlim_max);
+				printf(":%ju>\n", (uintmax_t)new->rlim_max);
 		}
 
 		if (prlimit(pid, lim->desc->resource, new, old) == -1)
-- 
1.8.5.6


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

* Re: [PATCH 0/6] minor last minute fixes for v2.30
  2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
                   ` (5 preceding siblings ...)
  2017-06-01  1:08 ` [PATCH 6/6] misc: fix some warnings Ruediger Meier
@ 2017-06-01  7:52 ` Ruediger Meier
  2017-06-01  8:55   ` Karel Zak
  6 siblings, 1 reply; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  7:52 UTC (permalink / raw)
  To: util-linux

On Thursday 01 June 2017, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>
> This is all non-critical, in doubt skip it.

I've fixed some typos via github pull request.
https://github.com/karelzak/util-linux/pull/450


> Linux User (1):
>   tests: use stdbuf when stderr and stdout is randomly ordered
>
> Ruediger Meier (5):
>   tests: grep's short option -A is more portable
>   tests: avoid diff of diffs
>   build-sys: fix library order when linking
>   tests: handle non glibc error message for fallocate
>   misc: fix some warnings
>
>  lib/Makemodule.am                      |  2 +-
>  lib/plymouth-ctrl.c                    |  3 ++-
>  libblkid/samples/Makemodule.am         |  8 ++++----
>  libfdisk/src/Makemodule.am             |  2 +-
>  libmount/src/Makemodule.am             |  2 +-
>  libsmartcols/samples/Makemodule.am     |  2 +-
>  libuuid/src/Makemodule.am              |  2 +-
>  login-utils/last.c                     |  2 +-
>  misc-utils/test_uuidd.c                | 10 +++++-----
>  sys-utils/hwclock.h                    |  1 +
>  sys-utils/prlimit.c                    |  4 ++--
>  tests/expected/misc/swaplabel          |  2 +-
>  tests/expected/rename/exit_codes       |  2 +-
>  tests/expected/utmp/utmpdump-subsecond |  7 +++----
>  tests/ts/ipcs/headers                  | 26
> +++++++++++++------------- tests/ts/misc/fallocate                | 
> 5 ++---
>  tests/ts/misc/swaplabel                |  3 ++-
>  tests/ts/rename/exit_codes             |  3 ++-
>  tests/ts/utmp/utmpdump-subsecond       |  4 +---
>  19 files changed, 45 insertions(+), 45 deletions(-)

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

* Re: [PATCH 0/6] minor last minute fixes for v2.30
  2017-06-01  7:52 ` [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
@ 2017-06-01  8:55   ` Karel Zak
  2017-06-01  9:15     ` Ruediger Meier
  0 siblings, 1 reply; 19+ messages in thread
From: Karel Zak @ 2017-06-01  8:55 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Thu, Jun 01, 2017 at 09:52:43AM +0200, Ruediger Meier wrote:
> I've fixed some typos via github pull request.
> https://github.com/karelzak/util-linux/pull/450

Applied, thanks.

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

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

* Re: [PATCH 0/6] minor last minute fixes for v2.30
  2017-06-01  8:55   ` Karel Zak
@ 2017-06-01  9:15     ` Ruediger Meier
  2017-06-01 10:32       ` Karel Zak
  0 siblings, 1 reply; 19+ messages in thread
From: Ruediger Meier @ 2017-06-01  9:15 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Thursday 01 June 2017, Karel Zak wrote:
> On Thu, Jun 01, 2017 at 09:52:43AM +0200, Ruediger Meier wrote:
> > I've fixed some typos via github pull request.
> > https://github.com/karelzak/util-linux/pull/450
>
> Applied, thanks.

Hm, maybe you could revert the stdbuf patch. It does not work on 
OSX/travis.

cu,
Rudi

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

* Re: [PATCH 0/6] minor last minute fixes for v2.30
  2017-06-01  9:15     ` Ruediger Meier
@ 2017-06-01 10:32       ` Karel Zak
  0 siblings, 0 replies; 19+ messages in thread
From: Karel Zak @ 2017-06-01 10:32 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Thu, Jun 01, 2017 at 11:15:10AM +0200, Ruediger Meier wrote:
> On Thursday 01 June 2017, Karel Zak wrote:
> > On Thu, Jun 01, 2017 at 09:52:43AM +0200, Ruediger Meier wrote:
> > > I've fixed some typos via github pull request.
> > > https://github.com/karelzak/util-linux/pull/450
> >
> > Applied, thanks.
> 
> Hm, maybe you could revert the stdbuf patch. It does not work on 
> OSX/travis.

OK:-) I see the pull request... merged.

    Karel

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

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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-01  1:08 ` [PATCH 6/6] misc: fix some warnings Ruediger Meier
@ 2017-06-01 18:50   ` J William Piggott
  2017-06-06  8:10     ` Ruediger Meier
  0 siblings, 1 reply; 19+ messages in thread
From: J William Piggott @ 2017-06-01 18:50 UTC (permalink / raw)
  To: Ruediger Meier, util-linux


On 05/31/2017 09:08 PM, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>

 8< ---

> diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c
> index 75d8b93..0e60341 100644
> --- a/lib/plymouth-ctrl.c
> +++ b/lib/plymouth-ctrl.c
> @@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
>  	 * Please note that the PLYMOUTH_SOCKET_PATH has a
>  	 * leading NULL byte to mark it as an abstract socket
>  	 */
> -	ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
> +	ret = connect(fd, (const struct sockaddr *) &su,
> +	              offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
        ^^^^^^^^^^^^^^ whitespace

 8< ---


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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-01 18:50   ` J William Piggott
@ 2017-06-06  8:10     ` Ruediger Meier
  2017-06-06 18:18       ` J William Piggott
  0 siblings, 1 reply; 19+ messages in thread
From: Ruediger Meier @ 2017-06-06  8:10 UTC (permalink / raw)
  To: J William Piggott; +Cc: util-linux

On Thursday 01 June 2017, J William Piggott wrote:
> On 05/31/2017 09:08 PM, Ruediger Meier wrote:
> > From: Ruediger Meier <ruediger.meier@ga-group.nl>
>
>  8< ---
>
> > diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c
> > index 75d8b93..0e60341 100644
> > --- a/lib/plymouth-ctrl.c
> > +++ b/lib/plymouth-ctrl.c
> > @@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
> >  	 * Please note that the PLYMOUTH_SOCKET_PATH has a
> >  	 * leading NULL byte to mark it as an abstract socket
> >  	 */
> > -	ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1
> > + strlen(su.sun_path+1)); +	ret = connect(fd, (const struct
> > sockaddr *) &su,
> > +	              offsetof(struct sockaddr_un, sun_path) + 1 +
> > strlen(su.sun_path+1));
>
>         ^^^^^^^^^^^^^^ whitespace
>
>  8< ---

What would be the right whitespace style? I've made one indentation 
(tab) and some spaces to align the broken line regarding  "connect(".

I'm using tab only for indentation but not for alignment, to let it look 
nice independently of editors tab witdth. Is that wrong?

cu,
Rudi



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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-06  8:10     ` Ruediger Meier
@ 2017-06-06 18:18       ` J William Piggott
  2017-06-06 19:17         ` J William Piggott
  0 siblings, 1 reply; 19+ messages in thread
From: J William Piggott @ 2017-06-06 18:18 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux



On 06/06/2017 04:10 AM, Ruediger Meier wrote:
> On Thursday 01 June 2017, J William Piggott wrote:
>> On 05/31/2017 09:08 PM, Ruediger Meier wrote:
>>> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>>
>>  8< ---
>>
>>> diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c
>>> index 75d8b93..0e60341 100644
>>> --- a/lib/plymouth-ctrl.c
>>> +++ b/lib/plymouth-ctrl.c
>>> @@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
>>>  	 * Please note that the PLYMOUTH_SOCKET_PATH has a
>>>  	 * leading NULL byte to mark it as an abstract socket
>>>  	 */
>>> -	ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1
>>> + strlen(su.sun_path+1)); +	ret = connect(fd, (const struct
>>> sockaddr *) &su,
>>> +	              offsetof(struct sockaddr_un, sun_path) + 1 +
>>> strlen(su.sun_path+1));
>>
>>         ^^^^^^^^^^^^^^ whitespace
>>
>>  8< ---
> 
> What would be the right whitespace style? I've made one indentation 
> (tab) and some spaces to align the broken line regarding  "connect(".
> 
> I'm using tab only for indentation but not for alignment, to let it look 
> nice independently of editors tab witdth. Is that wrong?

I wouldn't call it 'wrong'. To my knowledge, it is not the style this
project uses. Eight spaces should be a tab. You have one tab and 14
spaces, it should be 2 tabs and 6 spaces. Actually, the Linux kernel
style guide (the chosen style guide for util-linux) says no spaces are
allowed for c indentation, but Karel seems to make an exception for that.

I have git configured to highlight eight spaces and when I looked at
this commit with 'git show' that line lit up in red. Something I do
not normally see happen in this project.

> 
> cu,
> Rudi
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-06 18:18       ` J William Piggott
@ 2017-06-06 19:17         ` J William Piggott
  2017-06-07 15:27           ` Sami Kerola
  0 siblings, 1 reply; 19+ messages in thread
From: J William Piggott @ 2017-06-06 19:17 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux



On 06/06/2017 02:18 PM, J William Piggott wrote:
> 
> 
> On 06/06/2017 04:10 AM, Ruediger Meier wrote:
>> On Thursday 01 June 2017, J William Piggott wrote:
>>> On 05/31/2017 09:08 PM, Ruediger Meier wrote:
>>>> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>>>
>>>  8< ---
>>>
>>>> diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c
>>>> index 75d8b93..0e60341 100644
>>>> --- a/lib/plymouth-ctrl.c
>>>> +++ b/lib/plymouth-ctrl.c
>>>> @@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
>>>>  	 * Please note that the PLYMOUTH_SOCKET_PATH has a
>>>>  	 * leading NULL byte to mark it as an abstract socket
>>>>  	 */
>>>> -	ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1
>>>> + strlen(su.sun_path+1)); +	ret = connect(fd, (const struct
>>>> sockaddr *) &su,
>>>> +	              offsetof(struct sockaddr_un, sun_path) + 1 +
>>>> strlen(su.sun_path+1));
>>>
>>>         ^^^^^^^^^^^^^^ whitespace
>>>
>>>  8< ---
>>
>> What would be the right whitespace style? I've made one indentation 
>> (tab) and some spaces to align the broken line regarding  "connect(".
>>
>> I'm using tab only for indentation but not for alignment, to let it look 
>> nice independently of editors tab witdth. Is that wrong?
> 
> I wouldn't call it 'wrong'. To my knowledge, it is not the style this
> project uses. Eight spaces should be a tab. You have one tab and 14
> spaces, it should be 2 tabs and 6 spaces. Actually, the Linux kernel
> style guide (the chosen style guide for util-linux) says no spaces are
> allowed for c indentation, but Karel seems to make an exception for that.
> 
> I have git configured to highlight eight spaces and when I looked at
> this commit with 'git show' that line lit up in red. Something I do
> not normally see happen in this project.
>

I forgot to mention, the line in question exceeds 80 columns and should
be split again (the line changed in last.c wraps now also).

>>
>> cu,
>> Rudi
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe util-linux" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-06 19:17         ` J William Piggott
@ 2017-06-07 15:27           ` Sami Kerola
  2017-06-07 17:09             ` Bruce Dubbs
  0 siblings, 1 reply; 19+ messages in thread
From: Sami Kerola @ 2017-06-07 15:27 UTC (permalink / raw)
  To: J William Piggott; +Cc: Ruediger Meier, util-linux

On 6 June 2017 at 20:17, J William Piggott <elseifthen@gmx.com> wrote:
>
>
> On 06/06/2017 02:18 PM, J William Piggott wrote:
>>
>>
>> On 06/06/2017 04:10 AM, Ruediger Meier wrote:
>>> On Thursday 01 June 2017, J William Piggott wrote:
>>>> On 05/31/2017 09:08 PM, Ruediger Meier wrote:
>>>>> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>>>>
>>>>  8< ---
>>>>
>>>>> diff --git a/lib/plymouth-ctrl.c b/lib/plymouth-ctrl.c
>>>>> index 75d8b93..0e60341 100644
>>>>> --- a/lib/plymouth-ctrl.c
>>>>> +++ b/lib/plymouth-ctrl.c
>>>>> @@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
>>>>>     * Please note that the PLYMOUTH_SOCKET_PATH has a
>>>>>     * leading NULL byte to mark it as an abstract socket
>>>>>     */
>>>>> -  ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1
>>>>> + strlen(su.sun_path+1)); +        ret = connect(fd, (const struct
>>>>> sockaddr *) &su,
>>>>> +                offsetof(struct sockaddr_un, sun_path) + 1 +
>>>>> strlen(su.sun_path+1));
>>>>
>>>>         ^^^^^^^^^^^^^^ whitespace
>>>>
>>>>  8< ---
>>>
>>> What would be the right whitespace style? I've made one indentation
>>> (tab) and some spaces to align the broken line regarding  "connect(".
>>>
>>> I'm using tab only for indentation but not for alignment, to let it look
>>> nice independently of editors tab witdth. Is that wrong?
>>
>> I wouldn't call it 'wrong'. To my knowledge, it is not the style this
>> project uses. Eight spaces should be a tab. You have one tab and 14
>> spaces, it should be 2 tabs and 6 spaces. Actually, the Linux kernel
>> style guide (the chosen style guide for util-linux) says no spaces are
>> allowed for c indentation, but Karel seems to make an exception for that.
>>
>> I have git configured to highlight eight spaces and when I looked at
>> this commit with 'git show' that line lit up in red. Something I do
>> not normally see happen in this project.
>>
>
> I forgot to mention, the line in question exceeds 80 columns and should
> be split again (the line changed in last.c wraps now also).

I would say 80 columns is preferred, but we should not be too strict with it.
Sometimes code does look better when wider, and that's fine.

And the spaces vs tab. Yep, we should prefer tabs but sometimes accidents
happen. Calling these 'wrong' is too strong. This is yet another preference
thing, and if someone notices during review spaces where there should be
tabs then that's a good review commend and should be fixed. But I would
not go so far that existing whitespaces ought to be fixed without a change
to code line where they are.

util-linux $ for i in $(find . -name '*.c'); do unexpand $i > $i- ; mv
$i- $i; done
util-linux $ git diff --stat
[...]
 79 files changed, 799 insertions(+), 799 deletions(-)

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

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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-07 15:27           ` Sami Kerola
@ 2017-06-07 17:09             ` Bruce Dubbs
  2017-06-07 23:39               ` Ruediger Meier
  2017-06-08  5:26               ` Bernhard Voelker
  0 siblings, 2 replies; 19+ messages in thread
From: Bruce Dubbs @ 2017-06-07 17:09 UTC (permalink / raw)
  To: kerolasa, J William Piggott; +Cc: Ruediger Meier, util-linux

Sami Kerola wrote:
> On 6 June 2017 at 20:17, J William Piggott <elseifthen@gmx.com> wrote:

>> I forgot to mention, the line in question exceeds 80 columns and should
>> be split again (the line changed in last.c wraps now also).
>
> I would say 80 columns is preferred, but we should not be too strict with it.
> Sometimes code does look better when wider, and that's fine.
>
> And the spaces vs tab. Yep, we should prefer tabs but sometimes accidents
> happen. Calling these 'wrong' is too strong. This is yet another preference
> thing, and if someone notices during review spaces where there should be
> tabs then that's a good review commend and should be fixed. But I would
> not go so far that existing whitespaces ought to be fixed without a change
> to code line where they are.
>
> util-linux $ for i in $(find . -name '*.c'); do unexpand $i > $i- ; mv
> $i- $i; done
> util-linux $ git diff --stat

Just to throw in my two cents, tabs in source code cause problems unless 
you have a comment like:

// vim: noai:ts=8:sw=8

and the emacs equivalent.

I spend a lot of effort aligning source code to make it readable. 
Research from the 1980s and early 1990s indicated the best levels of 
indentations for readability and comprehension of source code is between 2 
and 4 spaces.  I personally use 3 characters.

Using tabs with different settings destroys that readability.

IMO, embedded tabs in source code add nothing but problems.  Editors can 
easily substitute the correct number of spaces when you hit the tab key 
and spaces allow the reader to always see the code as the author intended.

However, it is your project and your rules.  I am not asking for a change.

   -- Bruce Dubbs
      linuxfromscratch.org


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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-07 17:09             ` Bruce Dubbs
@ 2017-06-07 23:39               ` Ruediger Meier
  2017-06-08  5:26               ` Bernhard Voelker
  1 sibling, 0 replies; 19+ messages in thread
From: Ruediger Meier @ 2017-06-07 23:39 UTC (permalink / raw)
  To: Bruce Dubbs; +Cc: kerolasa, J William Piggott, util-linux

On Wednesday 07 June 2017, Bruce Dubbs wrote:
> Sami Kerola wrote:
> > On 6 June 2017 at 20:17, J William Piggott <elseifthen@gmx.com> 
wrote:
> >> I forgot to mention, the line in question exceeds 80 columns and
> >> should be split again (the line changed in last.c wraps now also).
> >
> > I would say 80 columns is preferred, but we should not be too
> > strict with it. Sometimes code does look better when wider, and
> > that's fine.
> >
> > And the spaces vs tab. Yep, we should prefer tabs but sometimes
> > accidents happen. Calling these 'wrong' is too strong. This is yet
> > another preference thing, and if someone notices during review
> > spaces where there should be tabs then that's a good review commend
> > and should be fixed. But I would not go so far that existing
> > whitespaces ought to be fixed without a change to code line where
> > they are.
> >
> > util-linux $ for i in $(find . -name '*.c'); do unexpand $i > $i- ;
> > mv $i- $i; done
> > util-linux $ git diff --stat
>
> Just to throw in my two cents, tabs in source code cause problems
> unless you have a comment like:
>
> // vim: noai:ts=8:sw=8
>
> and the emacs equivalent.
>
> I spend a lot of effort aligning source code to make it readable.
> Research from the 1980s and early 1990s indicated the best levels of
> indentations for readability and comprehension of source code is
> between 2 and 4 spaces.  I personally use 3 characters.
>
> Using tabs with different settings destroys that readability.
>
> IMO, embedded tabs in source code add nothing but problems.  Editors
> can easily substitute the correct number of spaces when you hit the
> tab key and spaces allow the reader to always see the code as the
> author intended.

IMO it is no problem to write nice looking code if you don't "mix" tabs 
and spaces. Distinguish between indentation and alignment.

So I use these rules which do not conflict with kernel coding style and 
tab-width=8:

  1. tabs for indentation level only (same as the previous line)
  2. spaces for alignment only

That's why in this particular case I've made one tab for the indentation 
and 14 spaces for the nice looking alignment. Though usually alignment 
is nonsense anyways, so I could have better just used one more 
indentation (one tab) instead of that 14 spaces. But I would never use 
1 tab and 6 spaces to let look like 14 spaces. This would have also 
satisfied the 80 char limit without adding another ugly line break.

BTW we have many lines in the our code which are more than 80 chars when 
assuming tab-width=8. That's why I take it as de-facto standard to 
count the line length assuming tab-width=4.


> However, it is your project and your rules.  I am not asking for a
> change.
>
>    -- Bruce Dubbs
>       linuxfromscratch.org
>
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

* Re: [PATCH 6/6] misc: fix some warnings
  2017-06-07 17:09             ` Bruce Dubbs
  2017-06-07 23:39               ` Ruediger Meier
@ 2017-06-08  5:26               ` Bernhard Voelker
  1 sibling, 0 replies; 19+ messages in thread
From: Bernhard Voelker @ 2017-06-08  5:26 UTC (permalink / raw)
  To: Bruce Dubbs, kerolasa, J William Piggott; +Cc: Ruediger Meier, util-linux

On 06/07/2017 07:09 PM, Bruce Dubbs wrote:
> IMO, embedded tabs in source code add nothing but problems.

+1 for my personal taste as well.

IMO each project should just define its own indent(1) settings
and document them e.g. in README or README-HACKING, and then
nobody would have to think about it.

Have a nice day,
Berny

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

end of thread, other threads:[~2017-06-08  5:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-01  1:08 [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
2017-06-01  1:08 ` [PATCH 1/6] tests: grep's short option -A is more portable Ruediger Meier
2017-06-01  1:08 ` [PATCH 2/6] tests: avoid diff of diffs Ruediger Meier
2017-06-01  1:08 ` [PATCH 3/6] build-sys: fix library order when linking Ruediger Meier
2017-06-01  1:08 ` [PATCH 4/6] tests: use stdbuf when stderr and stdout is randomly ordered Ruediger Meier
2017-06-01  1:08 ` [PATCH 5/6] tests: handle non glibc error message for fallocate Ruediger Meier
2017-06-01  1:08 ` [PATCH 6/6] misc: fix some warnings Ruediger Meier
2017-06-01 18:50   ` J William Piggott
2017-06-06  8:10     ` Ruediger Meier
2017-06-06 18:18       ` J William Piggott
2017-06-06 19:17         ` J William Piggott
2017-06-07 15:27           ` Sami Kerola
2017-06-07 17:09             ` Bruce Dubbs
2017-06-07 23:39               ` Ruediger Meier
2017-06-08  5:26               ` Bernhard Voelker
2017-06-01  7:52 ` [PATCH 0/6] minor last minute fixes for v2.30 Ruediger Meier
2017-06-01  8:55   ` Karel Zak
2017-06-01  9:15     ` Ruediger Meier
2017-06-01 10:32       ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox