Re: proposal: remove automatic default selection from fdisk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 29 March 2009 01:43:35 H. Peter Anvin wrote:
> > Any comments?  Is this going to break someone's favourite USB stick
> > formatter?
> Almost certainly.  And yes, I agree this is a bug.  I've found it
> hideously annoying from day 1.
Let's fix it!  We can hack it to work both ways.

This approach should work (unless I'm missing something about the more 
esoteric partition types):  For 't' and 'd', if something other than the 
single automatic default (1, 2, 3 or 4) is given which is a valid value for 
the *next* input, then that default is selected, and the input is preserved 
for the next prompt.  With that scheme, the input below remains valid (wisdom 
from random bullettin board to create a partition, set the type, activate and 
write, my comments added):

	d       <=== delete: no partition given, single partition assumed
	u	<=== this is a valid command, not a value in range 1 to 4
	n
	p
	1
	489
	
	t       <=== type: no partition given, partition 1 assumed
	c       <=== this is not a value, but not 1 (nor 2, 3 or 4)
	a
	1
	w

So, when fdisk++ asks for a partition number (and there's only one 
possibility), the user can ignore the question, and type the reply for the 
next prompt -- the following command after 'd'elete, or the type of the 
partition.  For setting the 't'ype of the final partition, a script without 
modifications would *fail* to set partition types 1 to 4 (FAT12, XENIX root, 
XENIX usr, FAT16 <32M) (but usually type 1, FAT12, since few people number 
their first partition 2 to 4).  When last did an automatic script set those, 
I wonder ...

So, something like this:

Command (m for help): p 
...
Device Boot      Start         End      Blocks   Id  System
  hda2               1        1023     8217216   83  Linux

Command (m for help): d
Partition number (1-4): n   <===== this is the next command, not a partition
DEPRECATED BEHAVIOUR! THAT'S NOT A PARTITION
Selected default partition 2  <=== apply old behaviour

Command (m for help): n     <===== input carried over
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1023, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1023, default 1023):
Using default value 1023

...

Command (m for help): t
Partition number (1-4): 83           <=== Actually a partition type
DEPRECATED BEHAVIOUR! THAT'S NOT A PARTITION
Selected default partition 1         <=== apply old behaviour
Hex code (type L to list codes): 82  <===== input carried over
Changed system type of partition 1 to 82 (Linux swap)

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux