Bug 10461

Summary: df -P -- columns not aligned with output
Product: Busybox Reporter: jds86930
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: 1.26.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description jds86930 2017-10-26 21:36:15 UTC
When running "df -P", the output of the header columns is not aligned with the output rows in the same way that it is with running regular "df". This is also inconsistent with how "df -P" works on non-busybox versions of "df".

The expected behavior is that each filesystem aligns as:
column 1 is left aligned to the column header
columns 2 through n-1 are right-aligned to their column header
column n is left aligned to the column header

The current behavior is that columns 2-n are not aligned with the filesystem rows below.

This is an issue for me because I need to be able to scrape the output of "df -P" & column alignment is an important part of consistently scraping the output between busybox df & other versions of df.
Comment 1 Denys Vlasenko 2017-10-27 14:51:48 UTC
Rows will also fall out of alignment if printed values are too large to fit into allotted number of characters.

Wouldn't it be much simpler to parse the output by treating it as whitespace delimited list of numbers instead of matching character positions?
Comment 2 jds86930 2017-10-27 15:40:19 UTC
Simpler perhaps, but makes a different assumption, which is that none of the fields (ex, 'filesystem',' mounted on') will have spaces in them. For non-busybox versions of df, the column alignment being rigidly defined allowed me to control for potential field whitespace.