xfsprogs: packaging fixes
cover xfsprogs: packaging fixes
Hi Eric,
Here's a rollup of a few random fixes that <cough> might be <cough> needed to produce a working 5.14.3 package for <cough> reasons.
--D
PATCH 1/3 libxcmd: use emacs mode for command history editing
From: Darrick J. Wong <[email protected]>
Prior to xfsprogs 5.7.0, we built xfsprogs with libreadline support by default. In its default configuration, that library interpreted various keystrokes in a direct manner (e.g. backspace deletes the character to the left of the cursor), which seems consistent with how emacs behaves.
However, libeditline's default keybindings are consistent with vim, which means that suddenly users are presented with not the same line editing interface that they had before. Since libeditline is configurable (put "bind -v" in editrc if you really want vim mode), let's put things back the way they were. At least as much as we can.
--- db/input.c | 1 + libxcmd/input.c | 1 + 2 files changed, 2 insertions(+)
db/input.c +1 -0
@@ -227,6 +227,7 @@ fetchline(void)el_set (el,EL_SIGNAL ,1 );el_set (el,EL_PROMPT , el_get_prompt);el_set (el,EL_HIST , history, (const char *)hist); +el_set (el,EL_EDITOR ,"emacs" ); }if (inputstacksize ==1 ) {
libxcmd/input.c +1 -0
@@ -45,6 +45,7 @@ fetchline(void)el_set (el,EL_SIGNAL ,1 );el_set (el,EL_PROMPT , el_get_prompt);el_set (el,EL_HIST , history, (const char *)hist); +el_set (el,EL_EDITOR ,"emacs" ); } cmd =el_gets (el, &count);if (!cmd)
PATCH 2/3 mkfs: prevent corruption of passed-in suboption string values
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Eric and I were trying to play with mkfs.configuration files, when I spotted this (with the libini package from Ubuntu 20.04):
# cat << EOF > /tmp/r [data] su=2097152 sw=1 EOF # mkfs.xfs -f -c options=/tmp/r /dev/sda Parameters parsed from config file /tmp/r successfully -d su option requires a value
It turns out that libini's parser uses stack variables(!) to store the value of a key=value pair that it parses, and passes this stack array to the parse_cfgopt function. If the particular option calls getstr(), then we save the value of that pointer (not its contents) to the cli_params. Being a stack array, the contents will be overwritten by other function calls, which means that our value of '2097152' has been destroyed by the time we actually call getnum when we're validating the new fs config.
We never noticed this until now because the only other caller was getsubopt on the argv array, which gets chopped up but left intact in memory. The solution is to make a private copy of those strings if we ever save them for later. For now we'll be lazy and let the memory leak, since mkfs is not a long-running process.
--- mkfs/xfs_mkfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
mkfs/xfs_mkfs.c +10 -1
@@ -1438,12 +1438,21 @@ getstr(struct opt_params *opts, int index) { + char *ret; +check_opt (opts, index, true);/* empty strings for string options are not valid */ if (!str || *str =='\0' )reqval (opts->name, opts->subopts, index); -return (char *)str; + + ret =strdup (str); +if (!ret) { +fprintf (stderr,_ ("Out of memory while saving suboptions.\n" )); +exit (1 ); + } + +return ret; } static int
Re: [PATCH 2/3] mkfs: prevent corruption of passed-in suboption string values
Looks good,
PATCH v3 3/3 mkfs: add configuration files for the last few LTS kernels
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add some sample mkfs configuration files that capture the mkfs feature defaults at the time of the release of the last four upstream LTS kernels.
---
v3: make it easier to substitute the mkfs config dir with a single variable
v2: add missing config file for 5.4 kernel
--- include/builddefs.in | 2 ++ mkfs/Makefile | 10 +++++++++- mkfs/lts_4.19.conf | 13 +++++++++++++ mkfs/lts_5.10.conf | 13 +++++++++++++ mkfs/lts_5.15.conf | 13 +++++++++++++ mkfs/lts_5.4.conf | 13 +++++++++++++ mkfs/xfs_mkfs.c | 4 ++++ 7 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 mkfs/lts_4.19.conf create mode 100644 mkfs/lts_5.10.conf create mode 100644 mkfs/lts_5.15.conf create mode 100644 mkfs/lts_5.4.conf
include/builddefs.in +2 -0
@@ -66,6 +66,8 @@ DK_INC_DIR = @includedir@/disk PKG_MAN_DIR = @mandir@ PKG_DOC_DIR = @datadir@/doc/@pkg_name@ PKG_LOCALE_DIR = @datadir@/locale +PKG_DATA_DIR = @datadir@/@pkg_name@ +MKFS_CFG_DIR = @datadir@/@pkg_name@/mkfs CC = @cc@ BUILD_CC = @BUILD_CC@
mkfs/Makefile +9 -1
@@ -9,19 +9,27 @@ LTCOMMAND = mkfs.xfs HFILES = CFILES = proto.c xfs_mkfs.c +CFGFILES = \ + lts_4.19.conf \ + lts_5.4.conf \ + lts_5.10.conf \ + lts_5.15.conf LLDLIBS += $(LIBXFS) $(LIBXCMD) $(LIBFROG) $(LIBRT) $(LIBPTHREAD) $(LIBBLKID) \ $(LIBUUID) $(LIBINIH) $(LIBURCU) LTDEPENDENCIES += $(LIBXFS) $(LIBXCMD) $(LIBFROG) LLDFLAGS = -static-libtool-libs -default: depend $(LTCOMMAND) +default: depend $(LTCOMMAND) $(CFGFILES) include $(BUILDRULES) install: default $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR) + $(INSTALL) -m 755 -d $(MKFS_CFG_DIR) + $(INSTALL) -m 644 $(CFGFILES) $(MKFS_CFG_DIR) + install-dev: -include .dep
mkfs/lts_4.19.conf new file +13 -0
@@ -0,0 +1,13 @@ +# V5 features that were the mkfs defaults when the upstream Linux 4.19 LTS +# kernel was released at the end of 2018. + +[metadata] +bigtime=0 +crc=1 +finobt=1 +inobtcount=0 +reflink=0 +rmapbt=0 + +[inode] +sparse=1
mkfs/lts_5.10.conf new file +13 -0
@@ -0,0 +1,13 @@ +# V5 features that were the mkfs defaults when the upstream Linux 5.10 LTS +# kernel was released at the end of 2020. + +[metadata] +bigtime=0 +crc=1 +finobt=1 +inobtcount=0 +reflink=1 +rmapbt=0 + +[inode] +sparse=1
mkfs/lts_5.15.conf new file +13 -0
@@ -0,0 +1,13 @@ +# V5 features that were the mkfs defaults when the upstream Linux 5.15 LTS +# kernel was released at the end of 2021. + +[metadata] +bigtime=1 +crc=1 +finobt=1 +inobtcount=1 +reflink=1 +rmapbt=0 + +[inode] +sparse=1
mkfs/lts_5.4.conf new file +13 -0
@@ -0,0 +1,13 @@ +# V5 features that were the mkfs defaults when the upstream Linux 5.4 LTS +# kernel was released at the end of 2019. + +[metadata] +bigtime=0 +crc=1 +finobt=1 +inobtcount=0 +reflink=1 +rmapbt=0 + +[inode] +sparse=1
mkfs/xfs_mkfs.c +4 -0
@@ -3875,6 +3875,10 @@ main( .nodalign = false, .nortalign = false, .bigtime = false, + /* + * When we decide to enable a new feature by default, + * please remember to update the mkfs conf files. + */ }, };
Re: [PATCH v3 3/3] mkfs: add configuration files for the last few LTS kernels
Looks good,
[PATCH v2 4/3] mkfs: document sample configuration file location
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Update the documentation to note where one can find sample configuration files. While we're at it, add -c to the topmost list of mkfs.xfs options.
---
v2: use the mkfs config file directory from the build system
---
man/man8/Makefile | 7 +++++++
man/man8/mkfs.xfs.8.in | 4 ++++
2 files changed, 11 insertions(+)
rename man/man8/{mkfs.xfs.8 => mkfs.xfs.8.in} (99%)man/man8/Makefile +7 -0
@@ -12,8 +12,10 @@ ifneq ("$(ENABLE_SCRUB)","yes") else MAN_PAGES = $(shell echo *.$(MAN_SECTION)) endif +MAN_PAGES += mkfs.xfs.8 MAN_DEST = $(PKG_MAN_DIR)/man$(MAN_SECTION) LSRCFILES = $(MAN_PAGES) +DIRT = mkfs.xfs.8 default : $(MAN_PAGES)
@@ -22,4 +24,9 @@ include $(BUILDRULES) install : default $(INSTALL) -m 755 -d $(MAN_DEST) $(INSTALL_MAN) + +mkfs.xfs.8: mkfs.xfs.8.in + @echo " [SED] $@" + $(Q)$(SED) -e 's|@mkfs_cfg_dir@|$(MKFS_CFG_DIR)|g' < $^ > $@ + install-dev :
man/man8/mkfs.xfs.8.in renamed from man/man8/mkfs.xfs.8 +4 -0
@@ -7,6 +7,9 @@ mkfs.xfs \- construct an XFS filesystem .B \-b .I block_size_options ] [ +.B \-c +.I config_file_options +] [ .B \-m .I global_metadata_options ] [
@@ -159,6 +162,7 @@ The configuration options will be sourced from the file specified by the option string. This option can be use either an absolute or relative path to the configuration file to be read. +Sample configuration files can be found in @mkfs_cfg_dir@. .RE .PP .PD 0
Christoph Hellwig
Reviewed-byRe: [PATCH v2 4/3] mkfs: document sample configuration file location
Looks good,