misc-utils/wipefs.c: In function ‘main’:
misc-utils/wipefs.c:838:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
misc-utils/wipefs.c:838:3: note: use option -std=c99 or -std=gnu99 to compile your code
Signed-off-by: Karel Zak <kzak@redhat.com>
It might be useful for security auditing purposes list all possible
mount flags/options including default set which are normally not listed.
This patch adds "--vfs-all" option to list all fs-independent flags
on VFS-OPTIONS column, as well as libmount funcionality to accomplish
it.
i.e.:
$ findmnt -o VFS-OPTIONS
VFS-OPTIONS
rw,relatime
rw,nosuid,nodev,noexec,relatime
rw,nosuid,nodev,noexec,relatime
ro,nosuid,nodev,noexec
...
$ findmnt --vfs-all -o VFS-OPTIONS
VFS-OPTIONS
rw,exec,suid,dev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
ro,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,norelatime,nostrictatime,nolazytime,symfollow
...
[kzak@redhat.com: - cleanup coding style and comments]
Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
It displays filesystem root attached to system, for example
btrfs with two mounted subvolumes:
$ lsblk -oNAME,SIZE,MOUNTPOINTS,FSROOTS /dev/sdc1
NAME SIZE MOUNTPOINTS FSROOTS
sdc1 50M /mnt/A /foo
/mnt/B /bar
Signed-off-by: Karel Zak <kzak@redhat.com>
* add libmount FS to struct lsblk_device
* add new column MOUNTPOINTS (pl.) with multi-line cells to display
all mountpoints relevant for the device
* the old MOUNTPOINT is backwardly compatible and it (usually) displays the
last device mountpoint from /proc/self/mountinfo
For example btrfs with more subvolumes:
$ lsblk -o+MOUNTPOINTS /dev/sdc1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT MOUNTPOINTS
sdc1 8:33 0 50M 0 part /mnt/test /mnt/A
/mnt/test
/mnt/B
Note, in this case MOUNTPOINT displays mount point where is mounted
root of the filesystem.
Signed-off-by: Karel Zak <kzak@redhat.com>
GNU libc's getopt_long(3) have the tradition of not shuffling arguments
to find options when either POSIXLY_CORRECT is defined in environment
variables or '+' prepended in short options. Hence, the current code
base is fine as is fine as is for util-linux built with GNU libc.
However, musl libc only honour POSIX convention when short options
prepended with '+'. musl libc doesn't care about POSIXLY_CORRECT.
Thus, the behaviour of util-linux's getopt(1) that linked with musl-libc
doesn't match with its own documentation.
Let's make sure a '+' is always prepended to short options if
POSIXLY_CORRECT is defined.
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
* '2020wk47' of https://github.com/kerolasa/util-linux:
build-sys: sort various lists in configure.ac
mkswap: tell how to fix insecure permissions and owner in warning
lsipc: make default output byte sizes to be in human units
man: add missing backslash to caret printing macro
lscpu: fix variable shadowing
uuidgen: give hint in usage() what uuid namepaces can be used
uuidgen: use errx() rather than fprintf() when priting errors
libuuid: simplify uuid_is_null() check
uuidparse: use uuid type definitions from libuuid header
uuidparse: use libuuid function to test nil uuid
We encode to "safe" strings almost all variables for 'blkid -o udev'
and we need it also for SYSTEM_ID, PUBLISHER_ID, APPLICATION_ID,
BOOT_SYSTEM_ID and recently added VOLUME_SET_ID and DATA_PREPARER_ID.
This change makes blkid from util-linux more compatible with built-in
udevd blkid.
Addresses: https://github.com/karelzak/util-linux/pull/1215 (commit 5cbffdb74f)
Signed-off-by: Karel Zak <kzak@redhat.com>
The shells are very restrictive about variable names, only [:alnum:]
chars are allowed (and alphabetic chars as the first char). The
library will replace "bad" chars with "_". The char '%' at the end is
replaced by _PCT.
Addresses: https://github.com/karelzak/util-linux/issues/1201
Signed-off-by: Karel Zak <kzak@redhat.com>
* pali/multisesssion:
libblkid: udf: add support for unclosed sequential Write-Once media
libblkid: udf: add support for multisession via session_offset hint
libblkid: iso9660: add support for multisession via session_offset hint
libblkid: fix blkid_probe_get_sb() to use hint offset calculation
libblkid: allow to specify offset defined by hint for blkid_probe_get_idmag()
libblkid: detect session_offset hint for optical discs
libblkid: do size correction of optical discs also by last written sector
libblkid: detect CD/DVD discs in packet writing mode
libblkid: overwrite existing hint
libblkid: export blkid_probe_reset_hints()
blkid: add --hint <name>=value
libblkid: add blkid_probe_{set,get}_hint()
* sami/uuidd-work:
uuidd: fix misleading indentation
uuidd: make timeout to take effect when debug is not defined
uuidd: remove unnecessary bulk request size limit
uuidd: add uuidd specific data types that are used in protocol
uuidd: reorder bulk time and random generation code
uuidd: document uuidd protocol
uuidd: override operation type when performing bulk request
uuidd: move option parsing to separate function
uuidd: add command-line option values struct
uuidd: use pid_t type when referring to process id
This is unnecessary, we have ${docsdir}/util-linux which is good
enough for these two getopt examples. I guess the "getopt"
subdirectory is legacy from time getopt has been merged into
util-linux.
Signed-off-by: Karel Zak <kzak@redhat.com>
This dependence is defined by
$ cat /sys/class/pktcdvd/device_map
pktcdvd0 252:0 11:0
Unfortunately, there is not any direct sysfs way how to refer this
relationship in /sys/{block,dev/block}. So, we have to read the
device_map file and then compare device numbers with the list.
$ lsblk /dev/sr0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
└─pktcdvd0 252:0 1 0B 0 disk
Addresses: https://github.com/karelzak/util-linux/issues/1185
Signed-off-by: Karel Zak <kzak@redhat.com>
The trailing comma made code to compile without issues, but meant all_done()
was called only when --debug was in defined in command-line.
Fixes: 3d6250e96b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Limiting random query to 1000 uuid's was pointless when the next line will
further restrict upper limit to 63 entries. The 63 entries is what fits to
the uuidd communication buffer with the header.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use a typedef for types that are sensitive what comes to uuidd protocol
field widths, read write sizes, and related checks.
Proposed-by: Karel Zak <kzak@redhat.com>
Reference: https://github.com/karelzak/util-linux/pull/1196#discussion_r528595794
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Write the data and response length values in same close to order they appear
in protocol. This should make code a little easier to read.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Seeing what can be expected should make it easier to understand what the
code does.
Notice that simply writing down the resposes one can start wondering deeper
questions, such as, why does the time bulk response reply only one uuid
followed by number how many were requested? Was that a some type of TODO
note?
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Relying to single vs bulk requests to be exactly two steps away from each
other was an unnecessary dirty trick.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Moving the option parsing to a separate function will allow moving some
variables from main() heap to be in scope that free them later. That should
make the uuidd to have a little bit smaller runtime memory allocation.
The static long options is changed to be local variable. That should make
it to be part of heap for a bit, until removed. Earlier the variable was in
data segment and permanently in runtime memory. Whether this makes any
impact either way is not entirely clear, but hope is the runtime memory
allocation is tiny bit smaller.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The struct will help seeing where the variable values are coming from. This
will also help upcoming refactoring.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier use of a variable that holds switch enabling boolean to hold process
id was a little bit strange, and not exactly correct. An int should be good
enough to hold any pid, but it is better to be precise and use the type that
is meant for the job.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
As mentioned in 'Generating optimal glyphs' title in the manual page
mentioned in reference:
Where a proper caret (^) that renders well in both a terminal and PDF is
required, use "\(ha".
Using a naked "~" character results in a poor rendering in PDF. Instead
use "\(ti".
Reference: https://man7.org/linux/man-pages/man7/man-pages.7.html#STYLE_GUIDE
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* 'whereis' of https://github.com/ferivoz/util-linux:
whereis: extend test case
whereis: filter bin, man and src differently
whereis: do not strip suffixes
whereis: do not ignore trailing numbers
whereis: add --disable-whereis to configure
whereis: add lib32 directories
whereis: support zst compressed man pages
whereis: fix out of boundary read
Consider "s." prefixes for source code files only (even though I do not
know which VCS does that), compression suffixes for manual pages and
strict matching for executables.
Calling "whereis python3" is kind of okay to return python3.8 next to
python3, but python3.8-config is not the same tool as python3.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
The whereis implementations of FreeBSD, macOS, NetBSD, and OpenBSD do
not strip suffixes. Although whereis is not a POSIX tool and has no
shared standard, even its manual page indicates that the supplied names
are command names.
Commands do not have a suffix on Linux systems.
Stripping suffixes actually leads to issues with tools like fsck.ext4,
since fsck.ext4 is not the same tool as fsck and definitely not the same
tool as fsck.minix.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
The commands diff and diff3 are so distinct that their manual pages
should not be mixed in whereis output.
Theoretically this works for commands and binaries with links to each
other, e.g. gpg and gpg2, but if gpg is version 1 and gpg2 is version 2
then manual pages do not match either.
Also the while loop does not decrement "i" while incrementing "dp". The
effect of this is that the output of whereis depends on manual pages
being compressed or not.
The easiest solution is to not ignore trailing numbers.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
Add zst as extension for manual pages. Current version of man-db
supports zst extension out of the box.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
It seems our putp() based output is not portable as some ncurses
implementations strictly follow POSIX where putp() accepts only
terminfo capability strings and nothing else.
We already use standard stdio.h functions to output terminfo strings
(e.g. for colors). It seems we can do the same for cal(1) to
highlight the current day.
Note that mix putp() and fputs() is bad idea due to different
buffering ways in some cases (see cal.c git log for more details).
This patch also reduces complexity of the code as we can directly
output to stdout without snprintf to string.
Addresses: https://github.com/karelzak/util-linux/pull/1167
Signed-off-by: Karel Zak <kzak@redhat.com>