Util-Linux Archive on lore.kernel.org
 help / color / Atom feed
* careful with that umount options, Eugene
@ 2019-06-04 11:51 Harald Dunkel
  2019-06-04 13:55 ` Václav Doležal
  2019-06-06 12:59 ` Karel Zak
  0 siblings, 2 replies; 6+ messages in thread
From: Harald Dunkel @ 2019-06-04 11:51 UTC (permalink / raw)
  To: util-linux

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: careful with that umount options, Eugene
  2019-06-04 11:51 careful with that umount options, Eugene Harald Dunkel
@ 2019-06-04 13:55 ` Václav Doležal
  2019-06-06 12:59 ` Karel Zak
  1 sibling, 0 replies; 6+ messages in thread
From: Václav Doležal @ 2019-06-04 13:55 UTC (permalink / raw)
  To: Harald Dunkel, util-linux

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: careful with that umount options, Eugene
  2019-06-04 11:51 careful with that umount options, Eugene Harald Dunkel
  2019-06-04 13:55 ` Václav Doležal
@ 2019-06-06 12:59 ` Karel Zak
  2019-06-06 23:31   ` Theodore Ts'o
  1 sibling, 1 reply; 6+ messages in thread
From: Karel Zak @ 2019-06-06 12:59 UTC (permalink / raw)
  To: Harald Dunkel; +Cc: util-linux

On Tue, Jun 04, 2019 at 01:51:58PM +0200, 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.

Fixed ... new version:

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

Thanks for your report.

   Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: careful with that umount options, Eugene
  2019-06-06 12:59 ` Karel Zak
@ 2019-06-06 23:31   ` Theodore Ts'o
  2019-06-07  7:20     ` Karel Zak
  0 siblings, 1 reply; 6+ messages in thread
From: Theodore Ts'o @ 2019-06-06 23:31 UTC (permalink / raw)
  To: Karel Zak; +Cc: Harald Dunkel, util-linux

On Thu, Jun 06, 2019 at 02:59:47PM +0200, Karel Zak wrote:
> On Tue, Jun 04, 2019 at 01:51:58PM +0200, 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.
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: careful with that umount options, Eugene
  2019-06-06 23:31   ` Theodore Ts'o
@ 2019-06-07  7:20     ` Karel Zak
  2019-06-07 13:26       ` Theodore Ts'o
  0 siblings, 1 reply; 6+ messages in thread
From: Karel Zak @ 2019-06-07  7:20 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Harald Dunkel, util-linux

On Thu, Jun 06, 2019 at 07:31:47PM -0400, Theodore Ts'o wrote:
> On Thu, Jun 06, 2019 at 02:59:47PM +0200, Karel Zak wrote:
> > On Tue, Jun 04, 2019 at 01:51:58PM +0200, 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.
> > 
> > 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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: careful with that umount options, Eugene
  2019-06-07  7:20     ` Karel Zak
@ 2019-06-07 13:26       ` Theodore Ts'o
  0 siblings, 0 replies; 6+ messages in thread
From: Theodore Ts'o @ 2019-06-07 13:26 UTC (permalink / raw)
  To: Karel Zak; +Cc: Harald Dunkel, util-linux

On Fri, Jun 07, 2019 at 09:20:03AM +0200, Karel Zak wrote:
> > 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
					

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 11:51 careful with that umount options, Eugene Harald Dunkel
2019-06-04 13:55 ` Václav Doležal
2019-06-06 12:59 ` Karel Zak
2019-06-06 23:31   ` Theodore Ts'o
2019-06-07  7:20     ` Karel Zak
2019-06-07 13:26       ` Theodore Ts'o

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org
	public-inbox-index util-linux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git