[misc-utils/wipefs.c:636] -> [misc-utils/wipefs.c:310]: (style) Local
variable usage shadows outer function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The old deprecated list output format ("-o list") copies gettex string
into fixed buffer, that's really bad idea.
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c: In function ‘process_path’:
misc-utils/hardlink.c:287:30: warning: operand of ?: changes signedness from ‘off_t’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Wsign-compare]
misc-utils/hardlink.c: In function ‘main’:
misc-utils/hardlink.c:455:5: warning: ‘exclude_pattern’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
Reason to retire NIOBUF is that it is obscure local definition, while BUFSIZ
is well understood and commonly used constant. Besized sizes of these are
not far off, the NIOBUF was 4096 bytes and BUFSIZ tends to be 8192 bytes.
Proposed-by: Karel Zak <kzak@redhat.com>
Reference: https://github.com/karelzak/util-linux/pull/783
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Well, sort of. Due to use of ctl values in atexit() print_summary() there
is need for global control structure.
Secondly couple variables can be moved to more restricted scope, namely the
PCRE variables are now in main().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This fixes two standards compliancy warnings.
hardlink.c:65:7: warning: ISO C forbids zero-size array ‘name’ [-Wpedantic]
Reference: https://en.wikipedia.org/wiki/Flexible_array_member
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* remove \r from internationalized messages
* remove \r from all output to make it easy to use (see for example
output file from "hardlink -vv --dry-run . &> log")
* remove unnecessary formatting stuff from output, just keep is simple
and stupid...
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's consolidate the version printing code. It also seems better to
use exit() after --version, because it's handled in different way by
ASAN.
It's strange, but ASAN reports leaks after return in main(). Note that
we do not use free-before-exit.
Signed-off-by: Karel Zak <kzak@redhat.com>
* document --tree (was missing in the man page)
* add optional argument to --tree to specify tree
For example:
$ lsblk -o KNAME,SIZE,MOUNTPOINT --tree=KNAME /dev/dm-0
KNAME SIZE MOUNTPOINT
dm-0 232.9G
└─dm-1 232.9G
└─dm-2 232.9G
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;
term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This change fixes "warning: variable 'var' may be uninitialized when used
here [-Wconditional-uninitialized]" warnings reported in various files.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* remove NAMELEN, use PATH_MAX
* mark global variables as static
* move all global variables to the begin of the code
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits)
hardlink: add first simple tests
hardlink: util-linux usage
hardlink: fix compiler warnings
hardlink: style indentations and license header
hardlink: enable build with and without pcre2
fixes for the fixes
temporal fix before re-patch (updates from Fedora repo)
Update hardlink.1
Fixed version number, added changelog about Todd Lewis' patch
exclude files via pcre
Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989)
spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file
Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file"
spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file
Mention -f option in the man page
do not allow to hardlink files across filesystems by default (#786719) (use -f option to override)
fix possible buffer overflows, integer overflows, update man page
fix URL and remove mmap() (#676962, #672917)
- update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816
mostly spec cleanup
...
The function colors_init() checks for colors, it means it fails
on monochrome terminals, but cal(1) in this case still need to
highlight the current day.
Reported-by: Nuno Silva <nunojsilva@ist.utl.pt>
Signed-off-by: Karel Zak <kzak@redhat.com>
this is deemed a useful special case since journalctl will only show
either the first or last element of the message array if the field
appears multiple times.
Based on patch from: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
https://github.com/karelzak/util-linux/pull/743
Addresses: https://github.com/karelzak/util-linux/issues/742
Signed-off-by: Karel Zak <kzak@redhat.com>
blkid(8) in high-level mode checks partitions and unpartitioned
whole-disk devices from the file /proc/partitions.
The current heuristic assumes that partition name ends with a digit.
Unfortunately, this is not correct -- for example md0 or nvme0n1 are
whole-disk devices.
This commit uses sysfs_devno_is_wholedisk() to make sure the device is
a partition (according to kernel or DM). It's probably more expensive,
because this way requires more syscalls (to read stuff from /sys etc.).
The patch also adds more information to the blkid(8) man page.
Addresses: https://github.com/karelzak/util-linux/issues/728
Signed-off-by: Karel Zak <kzak@redhat.com>
We also need reference from child to parent to implement multi-parent
view. This change allows to walk on tree in both directions.
Signed-off-by: Karel Zak <kzak@redhat.com>
The target use-case are systems with large number of multi-path
devices or systems with duplicate (copied) filesystems.
The feature is flexible enough to use arbitrary column (for example
WWM or UUID, ...) as de-duplication key.
For example tree with multi-path devices sd{c,d,e,f}
./lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 200M 0 part /boot
├─sda3 8:3 0 130.3G 0 part
├─sda4 8:4 0 50G 0 part /
└─sda5 8:5 0 42.9G 0 part
sdb 8:16 0 74.5G 0 disk
└─sdb1 8:17 0 74.5G 0 part /home/archive
sdc 8:32 0 100M 0 disk
└─mpatha 253:0 0 100M 0 mpath
├─mpatha1 253:1 0 50M 0 part
└─mpatha2 253:2 0 49M 0 part
sdd 8:48 0 100M 0 disk
└─mpatha 253:0 0 100M 0 mpath
├─mpatha1 253:1 0 50M 0 part
└─mpatha2 253:2 0 49M 0 part
sde 8:64 0 100M 0 disk
└─mpatha 253:0 0 100M 0 mpath
├─mpatha1 253:1 0 50M 0 part
└─mpatha2 253:2 0 49M 0 part
sdf 8:80 0 100M 0 disk
└─mpatha 253:0 0 100M 0 mpath
├─mpatha1 253:1 0 50M 0 part
└─mpatha2 253:2 0 49M 0 part
De-duplicate by WWN:
./lsblk -M WWN
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 200M 0 part /boot
├─sda3 8:3 0 130.3G 0 part
├─sda4 8:4 0 50G 0 part /
└─sda5 8:5 0 42.9G 0 part
sdb 8:16 0 74.5G 0 disk
└─sdb1 8:17 0 74.5G 0 part /home/archive
sdc 8:32 0 100M 0 disk
└─mpatha 253:0 0 100M 0 mpath
├─mpatha1 253:1 0 50M 0 part
└─mpatha2 253:2 0 49M 0 part
Addresses: https://github.com/karelzak/util-linux/issues/616
Signed-off-by: Karel Zak <kzak@redhat.com>
The new implementation differentiates between partitions and another
dependences -- this is regression, we need root devices only.
Signed-off-by: Karel Zak <kzak@redhat.com>
Don't keep open sysfs file descriptors for all time to avoid problems
on systems with huge number of block devices.
Signed-off-by: Karel Zak <kzak@redhat.com>
This is necessary to implement --inverse. Note that this new
implementation scans /sys/dev/block/ to get top-level devices
and than it calls process_one_device().
Note that standard non-inverse tree does not use process_one_device()
as it's more effective to scan /sys/block where are no partitions.
Signed-off-by: Karel Zak <kzak@redhat.com>
The goal is to call process_one_device() from process_all_devices(),
so let's it keep in code in the right order.
Signed-off-by: Karel Zak <kzak@redhat.com>
This change allows read devices from sysfs only once and reuse device
properties if the device is references more than once in the tree
(RAIDs, etc.).
* every device is in the tree only once (tree->devices list)
* iterate_block_devices() reuse already read devices (for example if
already read for any dependence)
* the smartscols table is build from the final tree
The patch temporary disables dependencies evaluation (in
process_blkdev() to keep the patch small and simple.
Signed-off-by: Karel Zak <kzak@redhat.com>
The patch does not change code logic and semantic -- just rename.
* set_cxt() to set_device()
* struct blkdev_cxt to lsblk_device
Signed-off-by: Karel Zak <kzak@redhat.com>
* add struct ul_timer as API abstraction to hide differences between
timer_create() and setitimer()
* add setitimer() detection to ./configure.ac
* add fallback code to use setitimer() if timer_create() not available
(for example on OSX)
Addresses: https://github.com/karelzak/util-linux/issues/584
Signed-off-by: Karel Zak <kzak@redhat.com>
blkid(8) returns information from partition table also for empty
partitions. This is necessary for example for udev, but it could be
confusing if you care about on-device content only.
Default:
# blkid -p /dev/md0p1; echo $?
/dev/md0p1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="6d8796b1-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="204800" PART_ENTRY_DISK="9:0"
0
With --no-part-details:
# blkid -p /dev/md0p1 --no-part-details; echo $?
2
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653413
Signed-off-by: Karel Zak <kzak@redhat.com>
This limits what the uuid daemon has access to when it runs.
Further improving this with additional option or making
things even tighter is most likely possible.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
In case where the non-standard `fpurge` function is available, we
redefine `__fpurge` to `fpurge`. We can do so because the only
difference between both functions is that one returns an error code
while the other does not. But as we do not check the error code either
way, we do not care about which one of them we use.
The above redefinition happens unconditionally if we know that `fpurge`
exists. Most notably, we also redefine it if we already do have an
`__fpurge` function available that could be used. This causes problems
on musl-based platforms, where we detect availability of `fpurge` in
libc, but where no function declaration for it exists in "stdio_ext.h".
The compiler thus prints a warning due to an unknown function, even
though it will link just fine.
Avoid this warning by only redefining `__fpurge` to `fpurge` when
HAVE___FPURGE is not defined.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
The structure `blkdev_cxt` has a `struct stat` member embedded, whose
size may not be known on some systems because of a missing include for
"sys/stat.h". On glibc-based systems, this header is included
transitively via "sys/statvfs.h", but on musl-based systems it is not.
Fix the resulting compile error due to unknown size of the struct by
including "sys/stat.h".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
The current code uses "part" or "disk" only if nothing else is
possible to recognize. It means for example partitions on loops (or
RAIDs, etc) are marked as "loop" rather than "part".
Addresses: https://github.com/karelzak/util-linux/issues/700
Signed-off-by: Karel Zak <kzak@redhat.com>
* split properties to separate struct which is allocated only when
udev or blkid provides some information
* use separate function for udev and blkid and hide details in generic
get_device_properties()
* make sure we do not overwrite stuff udev and blkid (but this is only
theoretic issue as we do not call get_properties_by_blkid() directly
from code)
Signed-off-by: Karel Zak <kzak@redhat.com>
We use --sysroot to get information about block devices from /proc and
/sys dumps. In this case does not make sense to read anything from
udev as udevd is about the current system devices.
Signed-off-by: Karel Zak <kzak@redhat.com>
sysfs device model is truncated to 16 characters:
> cat /sys/block/sda/device/model
Crucial_CT128MX1
> udevadm info --query=property /dev/sda | grep MODEL=
ID_MODEL=Crucial_CT128MX100SSD1
sysfs uses INQUARY response which has the 16 characters limitation and
udev uses something else.
Addresses: https://github.com/karelzak/util-linux/issues/690
Signed-off-by: Karel Zak <kzak@redhat.com>
Define the allowed length of the last (second) column to use the
whole line for text.
Use text blocks for long lines.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
A developmental version of "groff" issued a warning, for example with
"test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z":
troff: <logger.1>:299: warning: can't find font 't'
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
The normal journald functions add the location in the C source code files to
the log messages. This is nice for a big C based project, but logger is used in
scripts so it would be more useful to let users specify the location in the
script by adding the CODE_FUNC, CODE_FILE and CODE_FILE fields to the log
message.
It is already possible to do this, but it will result in two versions of these
fields: one for the location in logger.c and one for the location in the
script.
Seen on OSX:
misc-utils/wipefs.c:822:5: warning: implicit declaration of function 'rereadpt' is invalid in C99 [-Wimplicit-function-declaration]
rereadpt(fd, devname);
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This patch adds PTUUID and PTTYPE fields to lsblk, that are corresponding
fields to ID_PART_TABLE_UUID and ID_PART_TABLE_TYPE in udev database.
[kzak@redhat.com: - small change in PTUUID description]
Signed-off-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
It's possible we erase from the whole device before we erase from the
partition on the same disk:
# wipefs -a /dev/sdc /dev/sdc1
the current code calls re-read PT ioctl immediately after erase (so,
before sdc1 is processed). The result is that sdc1 node is no more
accessible:
# wipefs -a /dev/sdc /dev/sdc1
/dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdc: calling ioctl to re-read partition table: Success
wipefs: error: /dev/sdc1: probing initialization failed: No such file or directory
It seems the most simple solution is to postpone the re-read ioctl and
do it as the last thing.
# wipefs -a /dev/sdc /dev/sdc1
/dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdc1: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef
/dev/sdc: calling ioctl to re-read partition table: Success
The patch also adds a small delay before the re-read ioctl call. It's
not elegant, but without the usleep(25000) the first attempt returns
EBUSY.
Addresses: https://github.com/karelzak/util-linux/issues/598
Signed-off-by: Karel Zak <kzak@redhat.com>
While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file. That inspired me to look if there are more
strings that does not need translation project attention. This change
removes at least some of them, if not all.
Reference: e19cc7b65b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Punctuation marks have been left in the only argument of two-fonts
macros, instead of being separated from it to make the second one.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Use the correct macro (I, B) for the font change of one argument, not
those that are used for alternating two fonts, like "BR", "IR", "RB",
or "RI".
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
The new command line option --bytes disables human readable output for
the SIZE and keep size in bytes. We use the same concept for all our
utils.
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'rename-interactive' of https://github.com/g-raud/util-linux:
rename: fixup & style (no functional changes)
rename: test availability of __fpurge() and fpurge()
rename: ask(): call __fpurge() to cater for multi-byte characters
rename.1: describe interactive mode
rename: ask(): print n when EOF on input
rename: detect tty in cbreak mode to make ask() read a single byte
rename.1: fix warning section
rename: add option --interactive to ask before overwriting
rename: skip faccessat() failure if AT_SYMLINK_NOFOLLOW is not a valid flag
rename: check source file access early
Making a purge in cbreak mode also makes the code compatible with
canonical mode. This can be useful in the case a shell, like bash, does
not restore the tty state of stopped jobs before restarting them. An
alternative fix to this minor shortcoming would be to retest the tty
state each time inside ask().
Set tty_cbreak only when tty has a VMIN of 1 to avoid having to purge at
all in cbreak mode.
The prompt is still compatible with a non interactive input from a pipe.
This change makes rename detect inexisting files given on the command
line and consider them faliures. This is particularly useful with
--no-act (to detect extraneous arguments).
It also prevents skipping non existing files (when the modified name
happens to exist). This makes --verbose not print skipping messages of
false positives (the access error is printed instead).
* 'rename-fix-noact-without-nooverwrite' of https://github.com/g-raud/util-linux:
rename: prevent --no-act from setting --no-overwrite
rename: when --no-overwrite skip verbosily only when --verbose
rename: consolidate printing the symlink in addition to its target
rename: fix/reverse the semantics of --no-overwrite in --symlink mode
Input file is getopt.1
Test nr. 2:
Enable and fix warnings from 'test-groff'.
Input file is /tmp/getopt.1
<getopt.1>:5 (macro BI): only 1 argument, but more are expected
<getopt.1>:419 (macro IR): only 1 argument, but more are expected
<getopt.1>:421 (macro IR): only 1 argument, but more are expected
chk_manuals: Output is from: test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z
and
Test nr. 15:
Change the name of a macro for two fonts (e.g., BR and IR) to one letter,
if there is only one argument.
Add the second argument if needed. It is sometimes part of the first one.
5:.BI getopt
419:.IR /usr/share/getopt/
421:.IR /usr/share/doc/
#####
Test nr. 8:
Protect a full stop (.) with "\&", if it has a blank (white-space) in front
of or (ignoring transparent characters to the full stop) after it, and it does
not mean an end of a sentence.
204:the next parameter (i.e. separated by whitespace on the command
219:or as the next argument (i.e. separated by whitespace on the command
352:(i.e. a parameter that does not start with a
379:will be parsed. It will still do parameter shuffling (i.e. all
#####
Test nr. 20:
Use a macro to change to the italic font, instead of \fI [1], if
possible.
The macros have the italic corrections, but "\c" removes them.
[1] man-pages(7)
57:is set, or if the first \fIparameter\fR is not an option (does not start
144:Set quoting conventions to those of \fIshell\fR.
#####
Test nr. 21:
Use the word (in)valid instead of (il)legal if not related to legal matters.
See "www.gnu.org/prep/standards".
25:check for legal options. It uses the
#####
Test nr. 28:
Wrong distance between sentences or protect the indicator.
1) Separate the sentences and subordinate clauses; each begins on a new
line. See man-pages(7) and "info groff".
Or
2) Adjust space between sentences (two spaces),
3) or protect the indicator by adding "\&" after it.
The "indicator" is an "end-of-sentence character" (.!?).
204:the next parameter (i.e. separated by whitespace on the command
219:or as the next argument (i.e. separated by whitespace on the command
352:(i.e. a parameter that does not start with a
379:will be parsed. It will still do parameter shuffling (i.e. all
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
#####
This fixes a bug introduced by commit fabb90676 ("Added --no-override
option to rename.", 2017-05-27) where the fallthrough meant to let
--no-act set --verbose was changed to set --no-override (the previous
code was too smart).
Do not let --no-act set --verbose anymore but update the manual to
recommend adding option --verbose. This is to be able to make --no-act
detect only non existing file arguments (in a future commit).
The previous behaviour was to overwrite a symlink only when the new
destination did not exist, i.e. to avoid creating a symlink to an
existing file! It had not been documented and it seems
counter-intuitive to me. So the new behavior protects symlinks pointing
to existing targets from being changed.
Also update manpage to document this mode.
* 'master' of https://github.com/pali/util-linux:
tests: Add tests for FAT32 labels
blkid: Encode any field which starts with LABEL in same way as LABEL field
libblkid: vfat: Change parsing label in special cases
This was the error
uuidd: couldn't bind unix socket /var/tmp/portage/sys-apps/util-linux-2.31.1/work/util-linux-2.31.1-abi_x86_64.amd64/tests/output/uuid/uuiddkOcTUuoZ7kaP3: Address already in use
because the socket path was truncated to 108 chars which was luckily
an existing directory.
Now we abort early with "uuidd: socket name too long: ... "
Reported-by: Thomas Deutschmann <whissi@gentoo.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
If util-linux is installed on a system without large file support,
an out of memory issue can occur while processing a file which is
2 GB in size:
$ ./configure --disable-largefile && make
$ dd if=/dev/zero of=2gb-file seek=2147483646 count=1 bs=1
$ fincore 2gb-file
(endless loop)
fincore: failed to do mmap: 2gb-file: Cannot allocate memory
Even though iterating with "len" seems counter-intuitive, it fixes
this issue. The variable len is only in the last iteration not a
multiplication of pagesize -- which is the requirement for mmap.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
If a file is larger than 4 GB on a 32 bit system with large file
support (default), it can happen that not all pages are properly
processed. This happens due to an int truncation (off_t vs size_t).
You can reproduce this on 32 bit with these commands:
$ dd if=/dev/zero of=4gb-file seek=4294967295 count=1 bs=1
$ fincore 4gb-file
fincore: failed to do mmap: 4gb-file: Invalid argument
If a file is larger than 4 GB, the first few pages of a file won't
be properly processed. "len" will be smaller than window_size,
but the for-loop iterates "window_size" bytes, skipping some pages.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Let's use '[ ]' rather than '< >' to be compatible with our another
man pages. Note that all time addressing on cal(1) command line is
optional.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1542883
Signed-off-by: Karel Zak <kzak@redhat.com>
The test program follows CAL_TEST_TIME=<sec> rather than libc time().
It allows to use cal(1) in regression tests in cases where output
depends on the current time.
(We already use the same for example for logger.)
Signed-off-by: Karel Zak <kzak@redhat.com>
* modify number of months in row according to the terminal width
* don't print blank space behind last char on row
Signed-off-by: Karel Zak <kzak@redhat.com>
I don't know if this was an oversight or an overzealous
interpretation of POSIX. Just in case, I'll address the
POSIX possibility. POSIX description for cal(1) says:
If only the year operand is given, cal shall produce a
calendar for all twelve months in the given calendar year.
It also says that cal(1) has no options, so in that context
if an option is given then it should be expected to override
POSIX behavior.
Before patched all of these command displayed a full year:
cal -1 2020
cal -3 2020
cal -n6 2020
Patched the number of months options are honored.
This patch also fixes the -1 option which was a no-op.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Commit efafeaf set 1 Jan as week 1, but the change
was missed in week_to_day() and in the man page.
Before
cal --week=40 --iso 1752
October 1752
Su Mo Tu We Th Fr Sa
41 1 2 3 4 5 6 7
42 8 9 10 11 12 13 14
43 15 16 17 18 19 20 21
44 22 23 24 25 26 27 28
45 29 30 31
Patched
cal --week=40 --iso 1752
September 1752
Su Mo Tu We Th Fr Sa
36 1 2
37 3 4 5 6 7 8 9
38 10 11 12 13 14 15 16
39 17 18 19 20 21 22 23
40 24 25 26 27 28 29 30
Signed-off-by: J William Piggott <elseifthen@gmx.com>
cal: use ALTMON_* and _NL_ABALTMON_* constants to display
months in a standalone form correctly. These constants have just
been newly added to glibc. ALTMON_x has been used in BSD family
since 1990s and has been accepted as the future POSIX extension.
_NL_ABALTMON_* is exclusively a GNU extension but it is expected
to be added to POSIX in future.
More info: https://sourceware.org/bugzilla/show_bug.cgi?id=10871
Let's make it possible to use debug.h without environment variables.
Suggested-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Update cal.1 with the new options --reform and --iso.
Also add information about the calendar systems used and
the difference between the --julian option and the Julian
calendar system.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Create the new option: --reform <1752|gregorian|iso|julian>
This adds the capability to display either the proleptic Gregorian or
the Julian calendar systems exclusively.
Also create the option --iso as alias of --reform=gregorian.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
* introduce new flag __UL_DEBUG_FL_NOADDR to suppress pointer address printing
* use __UL_DEBUG_FL_NOADDR when SUID
* move ul_debugobj() to debugobj.h, and require UL_DEBUG_CURRENT_MASK
to provide access to the current mask from ul_debugobj(). It's better
than modify all ul_debugobj() calls and use the global mask as
argument.
* remove never used UL_DEBUG_DEFINE_FLAG
Reported-by: halfdog <me@halfdog.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
On Sun, Dec 17, 2017 at 07:47:49PM -0500, J William Piggott wrote
> * it contains multi-byte characters (which is what drew me to reading it).
> * it truncates one very important piece of the formula: ". . . (mod 7)."
> * it explains the values for 'e', but there is no 'e' in the code.
> * it doesn't include a row resolving 'e' in the table, so it is not
> obvious what it relates to in the code.
> * without citing it as an external reference, the comment language is confusing.
Co-Author: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This is more lightweight than calling stat(3). In same go add a regression
test to ensure changes like this will not break --no-overwrite option.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This applies also for LABEL_FATBOOT which contains bytes according to DOS
code page and therefore does not contain valid UTF-8 sequence.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Gregorian rule for leap years has been adopted by reformation in year
1782 (Calendar Act 1750), but all tools (date, SQL servers, etc. etc.)
don't care about it and apply the new rule for all year -- including
years before the reformation.
It's better to be compatible with another tools than try to be perfect :-)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1507271
Signed-off-by: Karel Zak <kzak@redhat.com>
* Start the ISO format flags at bit 0 instead of bit 1.
* Remove unnecessary _8601 from ISO format flag names to
avoid line wrapping and to ease readability.
* ISO timestamps have date-time-timzone in common, so move
the TIMEZONE flag to bit 2 causing all timestamp masks
to have the first three bits set and the last four bits
as timestamp 'options'.
* Change the 'SPACE' flag to a 'T' flag, because it makes
the code and comments more concise.
* Add common ISO timestamp masks.
* Implement the ISO timestamp masks in all applicable code
using the strxxx_iso() functions.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
The current code sets noact flag if unix socked connection failed. This is ugly.
We want to reconnect always in all cases (well, except --socket-error=on).
Signed-off-by: Karel Zak <kzak@redhat.com>
The libc syslog() reconnects on failed send(). We need the same thing
as logger(1) is expected as long time running tool. For example
recommended Apache configuration is:
ErrorLog "| /usr/bin/logger -t apache_error -p local6.debug"
The issue is that connection endpoint (e.g. syslogd) maybe restarted.
The simple way how to test is:
for i in $(seq 0 3600); do echo "This is message number $i"; sleep 1; done | logger --tcp --server 127.0.0.1 --port 514
and restart your syslog. The current implementation gets SIGPIPE or
write warning message, but it never reconnect.
Addresses: https://github.com/karelzak/util-linux/issues/363
Signed-off-by: Karel Zak <kzak@redhat.com>
* move list with offsets specified by -o to the wipe_control struct
* don't clone the list of offsets, just keep it simple and stupid
* apply all filters (-o and -t) in get_desc_for_probe()
* always return offset and len by get_desc_for_probe() and apply
always use libblkid hide & step-back
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1486777
Signed-off-by: Karel Zak <kzak@redhat.com>
The util-linux code was previously aligned to use @localstatedir@ and
the util-linux build system was set to override the default to use /run.
Current GNU Coding Standards introduced the @runstatedir@ variable
for this purpose. Lets use that instead.
The GNU default for @runstatedir@ is ${localstatedir}/run so util-linux
still override the default to be /run to preserve the status quo from
before. The only difference is that you'll now pass --runstatedir to
override the location on the command line instead of --localstatedir.
(FWIW, Debhelper in compat 11 will automatically start passing
--runstatedir=/run to all autotools configured builds. It already
passes --localstatedir=/var (to avoid it ending up with the GNU default
/usr/local/var) which breaks the util-linux build system code that
tries to default it to /run. This change will thus allow util-linux
and debhelper to work better together and avoid the need for a
package-specific override.)
Relevant historic commits:
* commit 07a16b9d1e
"build-sys: change --localstatedir to /run"
* commit 80c51185d5
"uuidd: use run configured state directory"
* commit 01c5b78794
"agetty: use configured run state directory"
[kzak@redhat.com: - add $runstatedir fallback for autoconf < 2.70
- check for unmodified $localstatedir]
CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Karel Zak <kzak@redhat.com>
This includes atleast the native multiarch path in the paths to search.
(Maybe also other multiarch paths should also be searched? But atleast
this is a first step.)
Before this change (on Debian):
$ whereis libc
libc: /usr/share/man/man7/libc.7.gz
After this change:
$ whereis libc
libc: /usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/libc.a /usr/share/man/man7/libc.7.gz
Addresses: https://bugs.debian.org/856968
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Clang analyzer warnings:
Dead store, Dead initialization:
lib/mbsedit.c:154:8: warning: Value stored to 'in' during its initialization is never read
char *in = (char *) &c;
^~ ~~~~~~~~~~~
misc-utils/findmnt-verify.c:129:14: warning: Value stored to 'cn' during its initialization is never read
const char *cn = tgt;
^~ ~~~
Dead store, Dead increment:
sys-utils/hwclock.c:1461:2: warning: Value stored to 'argv' is never read
argv += optind;
^ ~~~~~~
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
The old output is horrible and useless when more devices specified.
The old format is also too tricky if more signatures detected. The new
output uses one line for each signature, prefixed by device name.
For example my workstation:
# wipefs /dev/sda* /dev/sdb*
DEVICE OFFSET TYPE UUID LABEL
sda 0x1fe PMBR
sda 0x37e4895e00 gpt
sda 0x200 gpt
sda1 0x1fe vfat F2BC-BFEC EFI
sda1 0x0 vfat F2BC-BFEC EFI
sda1 0x36 vfat F2BC-BFEC EFI
sda2 0x438 ext4 c5490147-2a6c-4c8a-aa1b-33492034f927 BOOT
sda3 0x438 ext4 196972ad-3b13-4bba-ac54-4cb3f7b409a4 HOME
sda4 0x438 ext4 d834bc84-0089-4be1-9013-cd8bf35d5ffa ROOT
sda5 0x438 ext4 e8ce5375-29d4-4e2f-a688-d3bae4b8d162 WINE
sda6 0xff6 swap 210337c6-f8b5-4d65-aab5-a0f343fa9ad4 SWAP
sdb 0x200 gpt
sdb 0x1fe dos
sdb1 0x438 ext4 6467a684-0d10-4f61-a301-67bb26934d90
This patch add --noheadings, --json and --output.
Signed-off-by: Karel Zak <kzak@redhat.com>