Skip to contentSkip to conversation

careful with that umount options, Eugene

DISCUSSION Harald Dunkel 4 participants 6 messages Jun 4, 2019 – Jun 7, 2019 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi folks

by accident I pasted

umount ls -al /mnt/

into bash. My bad. AFAICT /proc was umounted immediately, the rest died slowly. Don't try this at home.

Point is, according to the man page this command line should have triggered an error message. "umount ls -al" doesn't make sense.

Do you think the command line parser could be fixed?

util-linux is version 2.29.2-1+deb9u1, as included in Debian. Of course I checked the diff for umount.c between 2.29 and 3.34-rc2. Apparently the getopt code has been improved, but I did not notice a fix for this particular problem.

Thanx in advance. Keep on your good work
Harri

#1 lore raw

Hi,
-a (--all) and -l (--lazy) are valid options and GNU getopt reorders arguments (options first) so umount has seen

    umount --all --lazy ls /mnt/

and because --all mode doesn't take any arguments, it ignored 'ls /mnt/'. Modifying this to error on extra args should be trivial.

As for the command unmounting /proc when it should be ignored, it is caused by umounting root dir with --lazy (MNT_DETACH) option. See umount2(2).

Regards,
Václav Doležal

Quoted 23 lines · On 2019-06-04 at 13:51 Harald Dunkel wrote:

Hi folks

by accident I pasted

    umount ls -al /mnt/

into bash. My bad. AFAICT /proc was umounted immediately, the rest died slowly. Don't try this at home.

Point is, according to the man page this command line should have triggered an error message. "umount ls -al" doesn't make sense.

Do you think the command line parser could be fixed?

util-linux is version 2.29.2-1+deb9u1, as included in Debian. Of course I checked the diff for umount.c between 2.29 and 3.34-rc2. Apparently the getopt code has been improved, but I did not notice a fix for this particular problem.

Thanx in advance. Keep on your good work
Harri

maintainer
#2 lore raw
In reply to Harald Dunkel
Quoted 8 lines · Harald Dunkel

Hi folks

by accident I pasted

umount ls -al /mnt/

into bash. My bad. AFAICT /proc was umounted immediately, the rest died slowly. Don't try this at home.

Fixed ... new version:

 # umount ls -al /mnt/
 umount: unexpected arguments
 Try 'umount --help' for more information.

Thanks for your report.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw
Quoted 7 lines · Karel Zak
Quoted 6 lines · Harald Dunkel

Hi folks

by accident I pasted

umount ls -al /mnt/

Quoted 8 lines
Quoted 2 lines

into bash. My bad. AFAICT /proc was umounted immediately, the rest died slowly. Don't try this at home.

Fixed ... new version:

 # umount ls -al /mnt/
 umount: unexpected arguments
 Try 'umount --help' for more information.

Hmm... Should we also prevent a lazy unmount of the root file system?

- Ted

maintainer
#4 lore raw
Quoted 11 lines · Theodore Ts'o
Quoted 10 lines · Karel Zak
Quoted 8 lines · Harald Dunkel

Hi folks

by accident I pasted

umount ls -al /mnt/

into bash. My bad. AFAICT /proc was umounted immediately, the rest died slowly. Don't try this at home.

Quoted 7 lines
Quoted 5 lines

Fixed ... new version:

 # umount ls -al /mnt/
 umount: unexpected arguments
 Try 'umount --help' for more information.

Hmm... Should we also prevent a lazy unmount of the root file system?

Not sure if we want to maintain extra rule/restriction in userspace. Is there any reason why this feature is supported by kernel?

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw
Quoted 4 lines · Karel Zak
Quoted 1 line

Hmm... Should we also prevent a lazy unmount of the root file system?

Not sure if we want to maintain extra rule/restriction in userspace. Is there any reason why this feature is supported by kernel?

I certainly can't think of one. I'll raise on linux-fsdevel; if there's no good reason ever, I agree that it's probably better to restrict in the kernel.

- Ted