未加星标

util-linux v2.29 -- what's new?

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二05 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

The release v2.29 (now rc1) is without dramatical changes, the small exception is libsmartcols where we have many improvements.

The old good cal(1) is more user-friendly now. It's possible to specify month by name (e.g. "cal January 2017") and use relative placeholders, for example:

cal now cal '1 year ago' cal '+2 moths' fdisk(8) allows to wipe newly created partitions -- the feature is possible to control by new command line option --wipe-partitions[==auto|never|default].

The default in the interactive mode is to ask user when a filesystem or RAID signature is detected. The goal is to be sure that new block devices are usable without any collisions and extra wipefs(8) step (because users are lazy and mkfs-like programs are often no smart enough to wipe the device).

fintmnt --verify is probably the most attractive new feature for admins. The command scans /etc/fstab and tries to verify the configuration. The traditional way is to use "mount -a" for this purpose, but it's overkill. The new --verify does not call mount(2), but it checks parsability, LABEL/UUID/etc. translation to paths, mountpoints order, support for specified FS types. The option --verify together with --verbose provides many details.

For example my ext4 filesystems:

# findmnt --verify --verbose -t ext4 / [ ] target exists [ ] LABEL=ROOT translated to /dev/sda4 [ ] source /dev/sda4 exists [ ] FS type is ext4 [W] recommended root FS passno is 1 (current is 2) /boot [ ] target exists [ ] UUID=c5490147-2a6c-4c8a-aa1b-33492034f927 translated to /dev/sda2 [ ] source /dev/sda2 exists [ ] FS type is ext4 /home [ ] target exists [ ] UUID=196972ad-3b13-4bba-ac54-4cb3f7b409a4 translated to /dev/sda3 [ ] source /dev/sda3 exists [ ] FS type is ext4 /home/misc [E] unreachable on boot required target: No such file or directory [ ] UUID=e8ce5375-29d4-4e2f-a688-d3bae4b8d162 translated to /dev/sda5 [ ] source /dev/sda5 exists [ ] FS type is ext4 0 parse errors, 1 error, 1 warning

When you create multiple loop block devices from one backing file then linux kernel does not care about possible collisions and the same on-disk filesystem is maintained by multiple independent in-memory filesystem instances. The result is obvious -- data lost and filesystem damage.

Now mount(8) rejects requests to create another device and mount filesystem for the same backing file. The command losetup --nooverlap reuse loop device if already exists for the same backing file. All the functionality calculate with offset and sizelimit options of course, so it's fine to have multiple regions (partitions) in the same image file and mount all of them in the same time. The restriction is that the regions should not overlap. Thanks to Stanislav Brabec from Suse!

Heiko Carstens from IMB (thanks!) has improved lscpu(1) for s390. Now it supports "drawer" topology level, static and dynamic MHz, machine type and a new option --physical.

The most important libsmartcols change is probably better support for multi-line cells. Now the library supports custom cell wrap functions -- this allows to wrap your text in cells after words, line breaks, etc. See multi-line cells (WRAPNL column) output:

TREE ID PARENT WRAPNL aaaa 1 0 aaa ├─bbb 2 1 bbbbb │ ├─ee 5 2 hello │ │ baby │ └─ffff 6 2 aaa │ bbb │ ccc │ ddd ├─ccccc 3 1 cccc │ │ CCCC │ └─gggggg 7 3 eee │ ├─hhh 8 7 fffff │ │ └─iiiiii 9 8 g │ │ hhhhh │ └─jj 10 7 ppppppppp └─dddddd 4 1 dddddddd DDDD DD

The another change is support for user defined padding chars; we use this feature for LIBSMARTCOLS_DEBUG_PADDING=on|off, for example:

$ LIBSMARTCOLS_DEBUG=all LIBSMARTCOLS_DEBUG_PADDING=on findmnt 2> /dev/null

For me really important is that we have regression tests for all libsmartcols table and tree formatting code now :-)

Igor Gnatenko from Red Hat (thanks!) continues to work on python binding for libsmartcols, see https://github.com/ignatenkobrain/python-smartcols and see example below.

The idea is to use libsmartcols as output formatter for Fedora/RHEL dnf (package manager for RPM-based Linux distributions, yum replacement). This is also reason why libsmartcols has been massively extended and improved in the last releases.

That's all. Thanks also to Werner Fink, Sami Kerola, Ruediger Meier and many others contributors!

#!/bin/python3 import smartcols tb = smartcols.Table() name = tb.new_column("NAME") name.tree = True age = tb.new_column("AGE") age.right = True ggf = tb.new_line() ggf[name] = "John" ggf[age] = "70" gfa = tb.new_line(ggf) gfa[name] = "Donald" gfa[age] = "50" fa = tb.new_line(gfa) fa[name] = "Benny" fa[age] = "30" ln = tb.new_line(fa) ln[name] = "Arlen" ln[age] = "5" ln = tb.new_line(fa) ln[name] = "Gerge" ln[age] = "7" fa = tb.new_line(gfa) fa[name] = "Berry" fa[age] = "32" ln = tb.new_line(ggf) ln[name] = "Alex" ln[age] = "44" print(tb)

NAME AGE John 70 ├─Donald 50 │ ├─Benny 30 │ │ ├─Arlen 5 │ │ └─Gerge 7 │ └─Berry 32 └─Alex 44

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: LinuxPython
分页:12
转载请注明
本文标题:util-linux v2.29 -- what's new?
本站链接:http://www.codesec.net/view/479877.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(72)