Sami Kerola [Thu, 18 May 2017 21:19:34 +0000 (22:19 +0100)]
rename: make --no-act to imply --verbose
It is reasonable to assume use of --no-act means one wants to always see
what would have happen if rename is done. To say same slightly differently,
if there is sn use case for silent rename --no-act run I cannot think one.
Pali Rohár [Wed, 17 May 2017 18:36:40 +0000 (20:36 +0200)]
libblkid: udf: Change algorithm for reporting UUID
Ensure that reported UUID always contains only lowercase hexadecimal digits
and is always 16 characters length, padded with zero digits.
Volume Set Identifier is converted to UTF-8 before generating UUID from it.
As it could potentially contain any Unicode character. So correctly handle
both 8bit and 16bit OSTA Compressed Unicode encodings.
Disks which have only lowercase hexadecimal digits in Volume Set Identifier
would have same UUID as before this patch.
Pali Rohár [Tue, 16 May 2017 21:52:05 +0000 (23:52 +0200)]
libblkid: udf: Correctly handle UDF strings encoded in 8bit OSTA Compressed Unicode
String encoded in 8bit OSTA Compressed Unicode contains one Unicode
codepoint per 8bits. Maximal Unicode codepoint is U+FF. Which effectively
means that it is equivalent to Latin1 encoding.
Before this patch libblkid copied raw 8bit OSTA Compressed Unicode from
disk and treated it as UTF-8. It worked fine just for UTF-8 invariants,
other characters were incorrectly encoded. This patch fixes this problem.
Note that processing UUID is not fixed in this patch.
Karel Zak [Thu, 11 May 2017 08:59:14 +0000 (10:59 +0200)]
Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
tests: Add UDF CD-ROM hybrid image (ISO+Joliet+UDF) created by Nero 6
tests: Fix test output for low-probe-udf to contain UDF data
Revert "libblkid: Probe UDF volumes for ISO9660 info as well"
Karel Zak [Tue, 9 May 2017 10:31:52 +0000 (12:31 +0200)]
lscpu: reuse the same buffer
Now we use libsmartcols for the default output and all is allocated in
the smartcols table. So, we can reuse the same buffer for all
sprintf/scanf calls.
lscpu: Read available CPUs max and min frequencies
Problem:"lscpu frequency-info" command was always reading CPU0
max and min frequencies. If CPU0 is guarded or offline then it used to
display max and min frequencies as NULL.
This patch will read overall CPU max and min frequencies.
Test Results:
Before Patch:
#lscpu (CPU0 is guarded/offline)
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 120
On-line CPU(s) list: 8-127
Thread(s) per core: 8
Core(s) per socket: 3
Socket(s): 4
NUMA node(s): 4
Model: 2.1 (pvr 004b 0201)
Model name: POWER8E (raw), altivec supported
CPU max MHz: (null)
CPU min MHz: (null)
L1d cache: 64K
L1i cache: 32K
L2 cache: 512K
L3 cache: 8192K
NUMA node0 CPU(s): 8-31
NUMA node1 CPU(s): 32-63
NUMA node16 CPU(s): 64-95
NUMA node17 CPU(s): 96-127
With Patch:
# ./lscpu
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 120
On-line CPU(s) list: 8-127
Thread(s) per core: 8
Core(s) per socket: 3
Socket(s): 4
NUMA node(s): 4
Model: 2.1 (pvr 004b 0201)
Model name: POWER8E (raw), altivec supported
CPU max MHz: 4322.0000
CPU min MHz: 2061.0000
L1d cache: 64K
L1i cache: 32K
L2 cache: 512K
L3 cache: 8192K
NUMA node0 CPU(s): 8-31
NUMA node1 CPU(s): 32-63
NUMA node16 CPU(s): 64-95
NUMA node17 CPU(s): 96-127
Karel Zak [Tue, 9 May 2017 09:58:23 +0000 (11:58 +0200)]
Merge branch '2017wk16' of git://github.com/kerolasa/lelux-utiliteetit
* '2017wk16' of git://github.com/kerolasa/lelux-utiliteetit:
chfn, chsh: use readline(3) to receive user input
findfs: use getopt_long() to parse options
logger: make month names, login name, and tag read-only objects
sulogin: reduce vulnerability surface
partx: add --list-types option
libblkid: add blkid_partitions_get_name()
docs: try to convince open(2) O_DIRECT rather than using raw device
blkid: add long options
lsipc: fix options parsing and sync with man page
Pali Rohár [Mon, 1 May 2017 11:03:55 +0000 (13:03 +0200)]
tests: Add UDF CD-ROM hybrid image (ISO+Joliet+UDF) created by Nero 6
This image was created by Nero Burning ROM version 6 via option CD-ROM
(UDF/ISO) with UDF version 2.01 and enabled ISO Joliet extension. Moreover
for testing purposes it has set custom Disc label (and also every other
identifier) which is different for ISO, Joiliet and UDF part. It contains
ISO/Joliet/UDF string prefix to distinguish between them.
So reading this image as basic ISO would produce different label as when
reading it as ISO with Joliet image and also different as UDF image.
UUID is different due to fact that ISO image does not have UUID and
libblkid generate one from compilation date. Plus "Joliet Extension" in UDF
context does not make sense.
Reporting meaningless ID_FS_LABEL=UDF_Volume written in that commit was
caused by reading wrong value for UDF label and it was fixed in commit 2f2730bc77c972d613cfec421468c84f15749708.
So after this revert blkid reports for UDF filesystems label of UDF
filesystem and not label of ISO (if present) like other systems. In most
cases UDF and ISO labels are same (sometimes just one is upper case).
Sami Kerola [Sat, 15 Apr 2017 20:46:38 +0000 (21:46 +0100)]
sulogin: reduce vulnerability surface
Hopefully these changes are unreachable code, but better safe than sorry
when dealing with setuid root code that is installed everywhere. Quite
obviously the introduced abort() calls protect from impossible inputs.
Secondly set all possible data to be read-only in attempt to make it more
difficult to alter anything at all.
Reference: https://www.securecoding.cert.org/confluence/display/c/DCL00-C.+Const-qualify+immutable+objects Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Thu, 13 Apr 2017 16:52:35 +0000 (17:52 +0100)]
libblkid: add blkid_partitions_get_name()
This new function can be use to enquiry what partition names libblkid is
aware of. First use of this information will be in partx(8) to make bash
completion to work without a magic list.
Sami Kerola [Thu, 13 Apr 2017 08:39:39 +0000 (09:39 +0100)]
blkid: add long options
This change attempts to make tab completion more reasonable by alloging
memorizable option names. That also has positive impact to manual page, in
which referrals to other options are now easier to understand.
All short options are kept exactly as they were to avoid ABI breakage. The
only exception is -f option that getopt(3) recognized, but was not found
from anywhere else. The -f has been part of blkid since the initial commit.
Sami Kerola [Wed, 12 Apr 2017 17:59:54 +0000 (18:59 +0100)]
lsipc: fix options parsing and sync with man page
Option --pid was never implemented so remove it from struct options and
manual page. Interestingly this option was not in usage(). Short option
string had 'u' that has never appear anywhere else, so it is also removed.
Finally add options --bytes and --numeric-perms to manual page.