Bug 84298 - [patch] allow mount(8) to recognize relative pathnames as mountpoints
Summary: [patch] allow mount(8) to recognize relative pathnames as mountpoints
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 5.4-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-29 13:50 UTC by Mikolaj Rydzewski
Modified: 2017-12-31 22:36 UTC (History)
0 users

See Also:


Attachments
mount_patch (1.84 KB, text/plain)
2005-07-29 13:50 UTC, Mikolaj Rydzewski
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikolaj Rydzewski 2005-07-29 13:50:19 UTC
	Current version of mount(8) requires to specify absolute mountpoint
	pathname. Let's assume one has some mountpoints located in /mnt:
	/mnt/cdrom, /mnt/floppy, /mnt/usb
	It should be possible to call mount(8) like this:
	mount cdrom (assuming the current directory is /mnt). It has
	more practical impact when system is configured to allow non-root
	users to mount (cdroms, usb sticks) to mountpoints in their home
	directories. It's much more flexible to run mount ~/usb than 
	mount /home/<username>/usb.
	And last but not least ;-) mount(8) is supposed to behave in such
	way - there's a correct call to realpath(3), but infortunately
	previous function checks mountpoint validity without using
	realpath(3) call.
	So my patch just polishes existing code.

Fix: Apply attached patch.
How-To-Repeat: 	Try to mount a filesystem using non absolute path name - an error
	will occur.
Comment 1 brooks 2005-07-29 17:06:56 UTC
> >Description:
> 	Current version of mount(8) requires to specify absolute mountpoint
> 	pathname. Let's assume one has some mountpoints located in /mnt:
> 	/mnt/cdrom, /mnt/floppy, /mnt/usb
> 	It should be possible to call mount(8) like this:
> 	mount cdrom (assuming the current directory is /mnt). It has
> 	more practical impact when system is configured to allow non-root
> 	users to mount (cdroms, usb sticks) to mountpoints in their home
> 	directories. It's much more flexible to run mount ~/usb than 
> 	mount /home/<username>/usb.

Not really an objection, but this last example is bogus.  As the example
below shows, tcsh, bash, sh, and csh all make this work since ~expansion
happens before the command is run by the shell:

[7:22pm] brooks@pagefault (/usr/ports): echo ~brooks
/usr/home/brooks
[9:04am] brooks@pagefault (/usr/ports): bash
brooks@pagefault$ echo ~brooks
/usr/home/brooks
brooks@pagefault$ exit
[9:04am] brooks@pagefault (/usr/ports): sh
$ echo ~brooks
/usr/home/brooks
$ [9:04am] brooks@pagefault (/usr/ports): csh
[9:04am] brooks@pagefault (/usr/ports): echo ~brooks
/usr/home/brooks
[9:04am] brooks@pagefault (/usr/ports): exit

-- Brooks
Comment 2 Mikolaj Rydzewski 2005-07-29 22:36:33 UTC
On Fri, 29 Jul 2005, Brooks Davis wrote:

>> 	Current version of mount(8) requires to specify absolute mountpoint
>> 	pathname. Let's assume one has some mountpoints located in /mnt:
>> 	/mnt/cdrom, /mnt/floppy, /mnt/usb
>> 	It should be possible to call mount(8) like this:
>> 	mount cdrom (assuming the current directory is /mnt). It has
>> 	more practical impact when system is configured to allow non-root
>> 	users to mount (cdroms, usb sticks) to mountpoints in their home
>> 	directories. It's much more flexible to run mount ~/usb than
>> 	mount /home/<username>/usb.
>
> Not really an objection, but this last example is bogus.  As the example
> below shows, tcsh, bash, sh, and csh all make this work since ~expansion
> happens before the command is run by the shell:

Yes, you're right, thanks for pointing this.

But the problem with mount ignoring relative mountpoint pathnames still 
exists.

Regards

-- 
Mikolaj Rydzewski    <miki@ma.krakow.pl>    PGP KeyID: 8b12ab02
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:38 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped