Project

General

Profile

Actions

Bug #14695

closed

format: input() feedback should be more verbose

Added by Toomas Soome about 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Current sample session with partition menu in format:

partition> p
Current partition table (original):
Total disk sectors available: 41926589 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      19.99GB         41926622    
  1 unassigned    wm                 0          0              0    
  2 unassigned    wm                 0          0              0    
  3 unassigned    wm                 0          0              0    
  4 unassigned    wm                 0          0              0    
  5 unassigned    wm                 0          0              0    
  6 unassigned    wm                 0          0              0    
  8   reserved    wm          41926623       8.00MB         41943006    

partition> 0
Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      19.99GB         41926622    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: 
Enter new starting Sector[34]: 0
`0' is out of range.
Enter new starting Sector[34]:

It is not too obvious why we can not use value 0. Sure, we could use 'help' there:

Enter new starting Sector[34]: help
Expecting an integer from 34 to 41943006
Enter new starting Sector[34]: 

But that also is not obvious thing to type in. Updated format:

Enter new starting Sector[34]: 0
`0' is out of range [34-41943006].
Enter new starting Sector[34]:

I think, this example above is a bit more user friendly.

Testing done: build/install/boot and manual test.

format> ver

Volume name = <        >
ascii name  = <VMware-Virtual NVMe Disk-1.3-20.00GB>
bytes/sector    =  512
sectors = 41943040
accessible sectors = 41926589
first usable sector = 34
last usable sector = 41943006
Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      19.99GB         41926622    
  1 unassigned    wm                 0          0              0    
  2 unassigned    wm                 0          0              0    
  3 unassigned    wm                 0          0              0    
  4 unassigned    wm                 0          0              0    
  5 unassigned    wm                 0          0              0    
  6 unassigned    wm                 0          0              0    
  8   reserved    wm          41926623       8.00MB         41943006    

partition> 0
Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      19.99GB         41926622    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: 
Enter new starting Sector[34]: 0
`0' is out of range [34-41943006].
Enter new starting Sector[34]: 
Enter partition size[41926590b, 41926623e, 20471mb, 19gb, 0tb]: 41943006b
partition> 0       
Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      20.00GB         41943039    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: 
Enter new starting Sector[34]: 
Enter partition size[41943006b, 41943039e, 20479mb, 19gb, 0tb]: 41943040b
Number of blocks must be less that the total available blocks.
Enter partition size[41943006b, 41943039e, 20479mb, 19gb, 0tb]: 20490mb
`20490.00mb' is out of range [0-20479.98]
Enter partition size[41943006b, 41943039e, 20479mb, 19gb, 0tb]: 20gb
`20.00gb' is out of range [0-20.00]
Enter partition size[41943006b, 41943039e, 20479mb, 19gb, 0tb]: 1tb
`1.00tb' is out of range [0-0.02]
Enter partition size[41943006b, 41943039e, 20479mb, 19gb, 0tb]: 
partition>

partition> 0
Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      20.00GB         41943039    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: 
Enter new starting Sector[34]: 
Enter partition size[41943006b, 41943039e, 20479mb, 19gb, 0tb]: $
partition> p
Current partition table (unnamed):
Total disk sectors available: 41926589 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm                34      19.99GB         41926622    
  1 unassigned    wm                 0          0              0    
  2 unassigned    wm                 0          0              0    
  3 unassigned    wm                 0          0              0    
  4 unassigned    wm                 0          0              0    
  5 unassigned    wm                 0          0              0    
  6 unassigned    wm                 0          0              0    
  8   reserved    wm          41926623       8.00MB         41943006    

partition>

Note the first block count is actually too large (reserved partition will not fit in), but current logic does allow such partition edits (label command would have been failed there - overlapped partitions are not allowed with GPT).

Actions #1

Updated by Electric Monk about 2 months ago

  • Gerrit CR set to 2153
Actions #2

Updated by Joshua M. Clulow about 2 months ago

That is definitely more helpful! Perhaps use parentheses instead of brackets, to distinguish it visually from the default values in the other prompts.

Actions #3

Updated by Toomas Soome about 2 months ago

Joshua M. Clulow wrote in #note-2:

That is definitely more helpful! Perhaps use parentheses instead of brackets, to distinguish it visually from the default values in the other prompts.

inclusive versus exclusive range notation;)

Actions #4

Updated by Toomas Soome about 2 months ago

  • Description updated (diff)
Actions #5

Updated by Electric Monk about 2 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit ecc39deb3ff51afe175edd847dcffb926c47a239

commit  ecc39deb3ff51afe175edd847dcffb926c47a239
Author: Toomas Soome <tsoome@me.com>
Date:   2022-05-18T15:32:49.000Z

    14695 format: input() feedback should be more verbose
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Approved by: Dan McDonald <danmcd@mnx.io>

Actions

Also available in: Atom PDF