summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
...
* | uuidd: cosmetic coding style changeKarel Zak2018-03-071-2/+1Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | uuidd: don't truncate long socket pathsRuediger Meier2018-03-071-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | fincore: Handle large files on 32 bit without LFSTobias Stoeckmann2018-02-261-3/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | fincore: Handle large files correctly on 32 bitTobias Stoeckmann2018-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | lsblk: document LSBLK_DEBUG=Karel Zak2018-02-161-0/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | misc: fix typos using codespellRuediger Meier2018-02-162-4/+4
| | | | | | | | | | | | Some more funny typos, please review carefully. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | cal: clean up man page synopsis syntaxKarel Zak2018-02-071-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | findmnt.8: remove spurious spaces before "--tree" and "--verbose"Jakub Wilk2018-02-041-2/+2
| | | | | | | | Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* | cal: add ifdef TEST_CALKarel Zak2018-02-022-2/+25
| | | | | | | | | | | | | | | | | | | | 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>
* | findfs: don't include exitcodes.hKarel Zak2018-02-011-1/+0Star
| | | | | | | | | | | | The code uses findfs return codes only. Signed-off-by: Karel Zak <kzak@redhat.com>
* | cal: remove extra space after year outputKarel Zak2018-01-301-3/+0Star
| | | | | | | | | | Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* | cal: don't use year header for -1, -3 or -nKarel Zak2018-01-301-1/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | cal: follow terminal widthKarel Zak2018-01-301-9/+19
| | | | | | | | | | | | | | * 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>
* | cal: do not set months_in_row with -3 optionJ William Piggott2018-01-241-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having the -3 option set months_in_row causes ordinal days to wrap; it overrides the automatic handling of months_in_row that falls back to 2 month columns for ordinal days. Before: cal -3j 2020 2020 July August September Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat 182 183 184 185 186 187 213 214 215 244 245 246 247 248 249 250 188 189 190 191 192 193 194 216 217 218 219 220 221 222 251 252 253 254 255 256 257 195 196 197 198 199 200 201 223 224 225 226 227 228 229 258 259 260 261 262 263 264 202 203 204 205 206 207 208 230 231 232 233 234 235 236 265 266 267 268 269 270 271 209 210 211 212 237 238 239 240 241 242 243 272 273 Patched: cal -3j 2020 2020 December January Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat 335 336 337 338 339 340 341 1 2 3 4 342 343 344 345 346 347 348 5 6 7 8 9 10 11 349 350 351 352 353 354 355 12 13 14 15 16 17 18 356 357 358 359 360 361 362 19 20 21 22 23 24 25 363 364 365 26 27 28 29 30 31 February Sun Mon Tue Wed Thu Fri Sat 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | cal: honor num_months when only a year argumentJ William Piggott2018-01-241-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | cal: fix first week calculationJ William Piggott2018-01-222-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: fix week calculations for 1752J William Piggott2018-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: cal --week=39 1752 September 1752 Su Mo Tu We Th Fr Sa 36 1 2 14 15 16 37 17 18 19 20 21 22 23 38 24 25 26 27 28 29 30 Patched: cal --week=39 1752 October 1752 Su Mo Tu We Th Fr Sa 39 1 2 3 4 5 6 7 40 8 9 10 11 12 13 14 41 15 16 17 18 19 20 21 42 22 23 24 25 26 27 28 43 29 30 31 Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | cal: Use ALTMON_* correctlyRafal Luzynski2018-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* | cal: fix julian calendars for large yearsJ William Piggott2018-01-221-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: cal --r julian 31 12 2147483646 December 2147483646 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Patched: cal --r julian 31 12 2147483646 December 2147483646 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()Karel Zak2018-01-172-2/+2
| | | | | | | | | | | | | | 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>
* | cal: update man pageJ William Piggott2018-01-161-9/+74
| | | | | | | | | | | | | | | | | | | | 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>
* | cal: add option to set Gregorian reform dateJ William Piggott2018-01-161-4/+49
| | | | | | | | | | | | | | | | | | | | | | 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>
* | cal: move REFORMATION_YEAR to control structJ William Piggott2018-01-151-37/+49
| | | | | | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | include/debug: don't print pointer address for SUID programsKarel Zak2018-01-122-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | rename.1: fix typo, where -> wereKenyon Ralph2017-12-231-1/+1
| |
* | cal: fix multi-byte comment, explain in better wayKarel Zak2017-12-181-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | whereis: fix typo in debug messageKarel Zak2017-12-141-1/+1
| | | | | | | | | | Reported-by: Matthew White <mehw.is.me@inventati.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* | Revert "cal: simplify leap year rule"Karel Zak2017-12-141-1/+5
| | | | | | | | | | | | | | It was mistake, we use extra rule for date < 1752 from the beginning and another calculations depends on this. This reverts commit b9bd8dc267a71611859496bff29e329868273714.
* | cal: explain magic values for day of week calculationKarel Zak2017-12-131-8/+16
| | | | | | | | | | | | Based on BERNDT E.SCHWERDTFEGER papers. Signed-off-by: Karel Zak <kzak@redhat.com>
* | fincore: fix a typo in fincore.1Masatake YAMATO2017-12-131-1/+1
| | | | | | | | Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* | mcookie: properly initialize hashKarel Zak2017-12-121-0/+1
| | | | | | | | | | | | This stupid mistake has been introduced by commit 46ae163a8e5dc8457f8e2828eb53db8e610af275. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/md5: use ul_/UL_ prefixKarel Zak2017-12-121-7/+7
| | | | | | | | | | | | | | The symbols names are too generic. Addresses: https://github.com/karelzak/util-linux/issues/548 Signed-off-by: Karel Zak <kzak@redhat.com>
* | rename: use access(3) to check if a file existsSami Kerola2017-12-041-2/+1Star
| | | | | | | | | | | | | | 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>
* | man: use long options in text and add example to uuidgenSami Kerola2017-11-281-7/+9
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | misc: fix typosSami Kerola2017-11-281-1/+1
|/ | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: add hint about perms to man pageKarel Zak2017-11-221-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: simplify leap year ruleKarel Zak2017-11-131-5/+1Star
| | | | | | | | | | | | 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>
* lib/timeutils: add common ISO timestamp masksJ William Piggott2017-11-101-9/+3Star
| | | | | | | | | | | | | | | | | | | | | | * 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>
* lslocks: add note about OFDLCKKarel Zak2017-11-032-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/signames: remove signame array from header fileKarel Zak2017-10-231-12/+11Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'kill-child-feature' of https://github.com/nh2/util-linuxKarel Zak2017-10-231-127/+1Star
|\ | | | | | | | | | | | | | | * 'kill-child-feature' of https://github.com/nh2/util-linux: unshare: Allow passing <signame> to --kill-child unshare: Add --kill-child option. signames: Make input char buffers const kill: Extract signal names into signames.h/signames.c
| * kill: Extract signal names into signames.h/signames.cNiklas Hambüchen2017-10-141-127/+1Star
| |
* | blkid: improve man page wordingKarel Zak2017-10-161-2/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | blkid: more info about ambivalent results to the man pageKarel Zak2017-10-161-0/+10
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | blkid: cleanup man page info about lsblkKarel Zak2017-10-161-15/+15
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: keep header generators independent on connectionKarel Zak2017-10-121-5/+1Star
| | | | | | | * avoid memory leaks * don't use incomplete or header after free() Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: make sure mmap(NULL, ...) [coverity scan]Karel Zak2017-10-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: allow to reconnect on initial failed connect tooKarel Zak2017-10-111-4/+7
| | | | | | | 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>
* logger: add dummy fallback for OSXKarel Zak2017-10-101-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: reconnect on failed send()Karel Zak2017-10-101-9/+38
| | | | | | | | | | | | | | | | | | | 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>