Skip to contentSkip to conversation

pull: five mutually unrelated changes

PATCH Applied Sami Kerola 3 participants 11 messages Jul 15, 2017 – Jul 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover pull: five mutually unrelated changes

Hello,

The 'big' change in this pull request is to drop reset(1) from util-linux. I don't think there is any point of keep this script hanging around. Rest should be pretty straightforward review.

Sorry about forgetting uuidparse(1) bash-completion file when that command was introduced, but on good side when I got around adding the completion I noticed that bash set -u is broken here and there. All instances of the set -u issue should be now fixed.

Both boilerplate.c and ldattach(8) changes are very minor, and hopefully do not need further explaining.

----------------------------------------------------------------
The following changes since commit 8ffa3b651d7e74acba8f1d831b7f68fdb3c66aae:
libfdisk: make fdisk compliant to UEFI/GPT specification on PMBR (2017-07-14 12:48:18 +0200)
are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git 2017wk28
for you to fetch changes up to abbcec4fc9c8d7fb835b4eafd1bc9d82acbf0056:
bash-completion: make completions to work when bash set -u is in use (2017-07-15 22:05:42 +0100)
----------------------------------------------------------------

Sami Kerola (5):
reset: remove script from the package
ldattach: simplify debugging function when vwarnx(3) is available
docs: add optional option back to struct option
uuidparse: add bash-completion file
bash-completion: make completions to work when bash set -u is in use

 Documentation/boilerplate.c   | 17 ++++++++--------
 Documentation/deprecated.txt  |  5 -----
 bash-completion/Makemodule.am |  3 +++
 bash-completion/blkid         |  2 +-
 bash-completion/fdisk         |  2 +-
 bash-completion/fincore       |  2 +-
 bash-completion/findmnt       |  2 +-
 bash-completion/losetup       |  2 +-
 bash-completion/lsipc         |  2 +-
 bash-completion/lslocks       |  2 +-
 bash-completion/lsmem         |  2 +-
 bash-completion/partx         |  2 +-
 bash-completion/prlimit       |  2 +-
 bash-completion/sfdisk        |  2 +-
 bash-completion/swapon        |  2 +-
 bash-completion/uuidparse     | 37 +++++++++++++++++++++++++++++++++++
 bash-completion/wdctl         |  2 +-
 bash-completion/zramctl       |  2 +-
 configure.ac                  |  9 +--------
 sys-utils/ldattach.c          | 10 +++++++---
 term-utils/Makemodule.am      |  6 ------
 term-utils/reset              | 19 ------------------
 term-utils/reset.1            | 45 -------------------------------------------
 23 files changed, 71 insertions(+), 108 deletions(-)
 create mode 100644 bash-completion/uuidparse
 delete mode 100755 term-utils/reset
 delete mode 100644 term-utils/reset.1
Signature · 1 line
2.13.3
#1 lore raw

PATCH 1/5 reset: remove script from the package

This script requires ncurses to work, and the ncurses provides reset so there should not be need to keep this script hanging around.

---
 Documentation/deprecated.txt |  5 -----
 configure.ac                 |  8 --------
 term-utils/Makemodule.am     |  6 ------
 term-utils/reset             | 19 -------------------
 term-utils/reset.1           | 45 --------------------------------------------
 5 files changed, 83 deletions(-)
 delete mode 100755 term-utils/reset
 delete mode 100644 term-utils/reset.1
Documentation/deprecated.txt +0 -5
index 82b80c1fd..34ea698da 100644
@@ -93,11 +93,6 @@ Why:	parallel port printers are probably almost extinct devices
 
 ----------------------------
 
-What:	reset
-Why:	ncurses has better reset(1)
-
-----------------------------
-
 The Single UNIX(TM) Specification, Version 2
 Copyright (C) 1997 The Open Group
 
configure.ac +0 -8
index f1928d6b4..c76c2a0f3 100644
@@ -1741,14 +1741,6 @@ UL_BUILD_INIT([rename])
 AM_CONDITIONAL([BUILD_RENAME], [test "x$build_rename" = xyes])
 
 
-AC_ARG_ENABLE([reset],
-  AS_HELP_STRING([--enable-reset], [build reset]),
-  [], [UL_DEFAULT_ENABLE([reset], [no])]
-)
-UL_BUILD_INIT([reset])
-AM_CONDITIONAL([BUILD_RESET], [test "x$build_reset" = xyes])
-
-
 AC_ARG_ENABLE([vipw],
   AS_HELP_STRING([--enable-vipw], [build vipw]),
   [], [UL_DEFAULT_ENABLE([vipw], [no])]
term-utils/Makemodule.am +0 -6
index ad1bb1f8a..da05a722c 100644
@@ -52,12 +52,6 @@ endif
 endif
 
 
-if BUILD_RESET
-dist_usrbin_exec_SCRIPTS += term-utils/reset
-dist_man_MANS += term-utils/reset.1
-endif
-
-
 if BUILD_MESG
 usrbin_exec_PROGRAMS += mesg
 dist_man_MANS += term-utils/mesg.1
term-utils/reset deleted +0 -19
deleted file mode 100755
index 43f83cbda..000000000
@@ -1,19 +0,0 @@
-#!/bin/sh
-# This command is deprecated.  The utility is in maintenance mode,
-# meaning we keep them in source tree for backward compatibility
-# only.  Do not waste time making this command better, unless the
-# fix is about security or other very critical issue.
-#
-# See Documentation/deprecated.txt for more information.
-stty sane
-tput clear
-tput rmacs
-tput rmm
-tput rmso
-tput rmul
-tput rs1
-tput rs2
-tput rs3
-bot=$((${LINES:-$(tput lines)} - 1))
-if test "${bot}" -le "0"; then bot=24; fi
-tput csr 0 ${bot}
term-utils/reset.1 deleted +0 -45

45 lines not on this page · raw message

Signature · 1 line
2.13.3
#2 lore raw

PATCH 2/5 ldattach: simplify debugging function when vwarnx(3) is available

In reply to Sami Kerola

The vwarnx(3) is probably not available in all libc implementations, in such cases use the earlier printout as a fallback.

---
 configure.ac         |  1 +
 sys-utils/ldattach.c | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
configure.ac +1 -0
index c76c2a0f3..38b968878 100644
@@ -428,6 +428,7 @@ AC_CHECK_FUNCS([ \
 	sysinfo \
 	timegm \
 	usleep \
+	vwarnx \
 	warn \
 	warnx \
 ])
sys-utils/ldattach.c +7 -3
index eb04b5e33..d33d68535 100644
@@ -137,11 +137,15 @@ static void dbg(char *fmt, ...)
 	if (debug == 0)
 		return;
 	fflush(NULL);
-	fprintf(stderr, "%s: ", program_invocation_short_name);
 	va_start(args, fmt);
+#ifdef HAVE_VWARNX
+	vwarnx(fmt, args);
+#else
+	fprintf(stderr, "%s: ", program_invocation_short_name);
 	vfprintf(stderr, fmt, args);
-	va_end(args);
 	fprintf(stderr, "\n");
+#endif
+	va_end(args);
 	fflush(NULL);
 	return;
 }
@@ -252,7 +256,7 @@ static int my_cfsetspeed(struct termios *ts, int speed)
 
 static void handler(int s)
 {
-	dbg("got SIG %i -> exiting\n", s);
+	dbg("got SIG %i -> exiting", s);
 	exit(EXIT_SUCCESS);
 }
 
Signature · 1 line
2.13.3
#3 lore raw

PATCH 3/5 docs: add optional option back to struct option

In reply to Sami Kerola

The line was accidentally removed in the reference commit where only the short option had to go. Rest of the change is indentation.

Reference: 326c5c93b917a623f346155c8b3438b379d9fd60

---
 Documentation/boilerplate.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
Documentation/boilerplate.c +9 -8
index 68ffbf7ea..a92f7f097 100644
@@ -69,14 +69,15 @@ int main(int argc, char **argv)
 		OPT_OPTIONAL	/* see howto-man-page.txt about short option */
 	};
 	static const struct option longopts[] = {
-		{ "no-argument",                no_argument,       NULL, 'n'       },
-		{ "required",                   required_argument, NULL, 'r'       },
-		{ "extremely-long-long-option", no_argument,       NULL, 'e'       },
-		{ "xyzzy",                      no_argument,       NULL, OPT_XYZZY },
-		{ "long-explanation",           no_argument,       NULL, 'l'       },
-		{ "foobar",                     no_argument,       NULL, 'f'       },
-		{ "version",                    no_argument,       NULL, 'V'       },
-		{ "help",                       no_argument,       NULL, 'h'       },
+		{ "no-argument",                no_argument,       NULL, 'n'          },
+		{ "optional",                   optional_argument, NULL, OPT_OPTIONAL },
+		{ "required",                   required_argument, NULL, 'r'          },
+		{ "extremely-long-long-option", no_argument,       NULL, 'e'          },
+		{ "xyzzy",                      no_argument,       NULL, OPT_XYZZY    },
+		{ "long-explanation",           no_argument,       NULL, 'l'          },
+		{ "foobar",                     no_argument,       NULL, 'f'          },
+		{ "version",                    no_argument,       NULL, 'V'          },
+		{ "help",                       no_argument,       NULL, 'h'          },
 		{ NULL, 0, NULL, 0 }
 	};
 
Signature · 1 line
2.13.3
#4 lore raw

PATCH 4/5 uuidparse: add bash-completion file

In reply to Sami Kerola
---
 bash-completion/Makemodule.am |  3 +++
 bash-completion/uuidparse     | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 bash-completion/uuidparse
bash-completion/Makemodule.am +3 -0
index a884a138e..a4cd4fc36 100644
@@ -183,6 +183,9 @@ endif
 if BUILD_LIBUUID
 dist_bashcompletion_DATA += bash-completion/uuidgen
 endif
+if BUILD_UUIDPARSE
+dist_bashcompletion_DATA += bash-completion/uuidparse
+endif
 if BUILD_UUIDD
 dist_bashcompletion_DATA += bash-completion/uuidd
 endif
bash-completion/uuidparse new file +37 -0
new file mode 100644
index 000000000..a646844f2
@@ -0,0 +1,37 @@
+_uuidparse_module()
+{
+	local cur prev OPTS
+	COMPREPLY=()
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+	case $prev in
+		'-o'|'--output')
+			local prefix realcur OUTPUT
+			realcur="${cur##*,}"
+			prefix="${cur%$realcur}"
+			for WORD in "UUID VARIANT TYPE TIME"; do
+				if ! [[ $prefix == *"$WORD"* ]]; then
+					OUTPUT="$WORD ${OUTPUT:-""}"
+				fi
+			done
+			compopt -o nospace
+			COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
+			return 0
+			;;
+		'-h'|'--help'|'-V'|'--version')
+			return 0
+			;;
+	esac
+	OPTS="
+		--json
+		--noheadings
+		--output
+		--raw
+		--help
+		--version
+	"
+	COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+	return 0
+
+}
+complete -F _uuidparse_module uuidparse
Signature · 1 line
2.13.3
#5 lore raw

PATCH 5/5 bash-completion: make completions to work when bash set -u is in use

In reply to Sami Kerola

User who want to avoid refering to none-existing variables got earlier the following error.

$ set -u
$ findmnt --output <tab>bash: OUTPUT: unbound variable

Here is short explanation of this setting.

$ help set
 -u  Treat unset variables as an error when substituting.
---
 bash-completion/blkid   | 2 +-
 bash-completion/fdisk   | 2 +-
 bash-completion/fincore | 2 +-
 bash-completion/findmnt | 2 +-
 bash-completion/losetup | 2 +-
 bash-completion/lsipc   | 2 +-
 bash-completion/lslocks | 2 +-
 bash-completion/lsmem   | 2 +-
 bash-completion/partx   | 2 +-
 bash-completion/prlimit | 2 +-
 bash-completion/sfdisk  | 2 +-
 bash-completion/swapon  | 2 +-
 bash-completion/wdctl   | 2 +-
 bash-completion/zramctl | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)
bash-completion/blkid +1 -1
index eb2ecf3fe..57b34c3f4 100644
@@ -59,7 +59,7 @@ _blkid_module()
 		prefix="${cur%$realcur}"
 		for WORD in $OUTPUT_ALL; do
 			if ! [[ $prefix == *"$WORD"* ]]; then
-				OUTPUT="$WORD $OUTPUT"
+				OUTPUT="$WORD ${OUTPUT:-""}"
 			fi
 		done
 		compopt -o nospace
bash-completion/fdisk +1 -1
index ef6c5beb4..855de1468 100644
@@ -49,7 +49,7 @@ _fdisk_module()
 			"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/fincore +1 -1
index 4988f198b..3639763b5 100644
@@ -12,7 +12,7 @@ _fincore_module()
 			OUTPUT_ALL='PAGES SIZE FILE RES'
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/findmnt +1 -1
index 5583fbf6c..bdfa5de5c 100644
@@ -55,7 +55,7 @@ _findmnt_module()
 
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/losetup +1 -1
index 7fee1d0ae..b58d8de94 100644
@@ -33,7 +33,7 @@ _losetup_module()
 				SIZELIMIT DIO"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/lsipc +1 -1
index ffe44b7d1..a40fe4286 100644
@@ -35,7 +35,7 @@ _lsipc_module()
 			"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/lslocks +1 -1
index 4ca1e6b6e..acc7b1ff6 100644
@@ -20,7 +20,7 @@ _lslocks_module()
 			OUTPUT_ALL="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/lsmem +1 -1
index 85cf3e01a..8f7a46ec3 100644
@@ -12,7 +12,7 @@ _lsmem_module()
 			OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE'
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/partx +1 -1
index 929000013..2368336ed 100644
@@ -15,7 +15,7 @@ _partx_module()
 			prefix="${cur%$realcur}"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/prlimit +1 -1
index fff7a85c5..f5e00bb16 100644
@@ -17,7 +17,7 @@ _prlimit_module()
 			OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/sfdisk +1 -1
index c00e8c799..9401f89ac 100644
@@ -28,7 +28,7 @@ _sfdisk_module()
 			"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/swapon +1 -1
index fc80af5eb..4a53ec5ac 100644
@@ -18,7 +18,7 @@ _swapon_module()
 			OUTPUT_ALL="NAME TYPE SIZE USED PRIO UUID LABEL"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/wdctl +1 -1
index 811b5e3cc..f1a870ef6 100644
@@ -29,7 +29,7 @@ _wdctl_module()
 			OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
bash-completion/zramctl +1 -1
index 8c7767ce0..672d8102a 100644
@@ -18,7 +18,7 @@ _zramctl_module()
 				MIGRATED MOUNTPOINT"
 			for WORD in $OUTPUT_ALL; do
 				if ! [[ $prefix == *"$WORD"* ]]; then
-					OUTPUT="$WORD $OUTPUT"
+					OUTPUT="$WORD ${OUTPUT:-""}"
 				fi
 			done
 			compopt -o nospace
Signature · 1 line
2.13.3
#6 lore raw
In reply to Sami Kerola
Quoted 2 lines · Sami Kerola

The 'big' change in this pull request is to drop reset(1) from util-linux. I don't think there is any point of keep this script hanging around.

Why do you think that. I find it useful when some application corrupts the screen. I realize that reset is a symlink to tset, but I find reset easier to remember/use.

-- Bruce

#7 lore raw
Quoted 6 lines · Bruce Dubbs
Quoted 2 lines

The 'big' change in this pull request is to drop reset(1) from util-linux. I don't think there is any point of keep this script hanging around.

Why do you think that. I find it useful when some application corrupts the screen. I realize that reset is a symlink to tset, but I find reset easier to remember/use.

The ncurses package contains both binaries tput(1) and reset(1). So this script will not work without ncurses, and the very same package has the binary that obsoletes the script.

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/
#8 lore raw
Quoted 11 lines · Sami Kerola
Quoted 6 lines · Bruce Dubbs
Quoted 2 lines

The 'big' change in this pull request is to drop reset(1) from util-linux. I don't think there is any point of keep this script hanging around.

Why do you think that. I find it useful when some application corrupts the screen. I realize that reset is a symlink to tset, but I find reset easier to remember/use.

The ncurses package contains both binaries tput(1) and reset(1). So this script will not work without ncurses, and the very same package has the binary that obsoletes the script.

Thanks. I agree that duplicate functions should be removed.

-- Bruce

maintainer
#9 lore raw
Quoted 9 lines · Bruce Dubbs
Quoted 8 lines · Sami Kerola
Quoted 6 lines · Bruce Dubbs
Quoted 2 lines

The 'big' change in this pull request is to drop reset(1) from util-linux. I don't think there is any point of keep this script hanging around.

Why do you think that. I find it useful when some application corrupts the screen. I realize that reset is a symlink to tset, but I find reset easier to remember/use.

Quoted 5 lines
Quoted 3 lines

The ncurses package contains both binaries tput(1) and reset(1). So this script will not work without ncurses, and the very same package has the binary that obsoletes the script.

Thanks. I agree that duplicate functions should be removed.

And note that it's already deprecated and disabled by default. You need --enable-reset now. I guess distros use reset(1) from ncurses for really long time.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#10 lore raw
In reply to Sami Kerola
Quoted 19 lines · Sami Kerola
 Documentation/boilerplate.c   | 17 ++++++++--------
 Documentation/deprecated.txt  |  5 -----
 bash-completion/Makemodule.am |  3 +++
 bash-completion/blkid         |  2 +-
 bash-completion/fdisk         |  2 +-
 bash-completion/fincore       |  2 +-
 bash-completion/findmnt       |  2 +-
 bash-completion/losetup       |  2 +-
 bash-completion/lsipc         |  2 +-
 bash-completion/lslocks       |  2 +-
 bash-completion/lsmem         |  2 +-
 bash-completion/partx         |  2 +-
 bash-completion/prlimit       |  2 +-
 bash-completion/sfdisk        |  2 +-
 bash-completion/swapon        |  2 +-
 bash-completion/uuidparse     | 37 +++++++++++++++++++++++++++++++++++
 bash-completion/wdctl         |  2 +-
 bash-completion/zramctl       |  2 +-
 configure.ac                  |  9 +--------
Quoted 8 lines
 sys-utils/ldattach.c          | 10 +++++++---
 term-utils/Makemodule.am      |  6 ------
 term-utils/reset              | 19 ------------------
 term-utils/reset.1            | 45 -------------------------------------------
 23 files changed, 71 insertions(+), 108 deletions(-)
 create mode 100644 bash-completion/uuidparse
 delete mode 100755 term-utils/reset
 delete mode 100644 term-utils/reset.1

Applied, thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com