NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
toolchain/60008: MAKEDEV should let caller say whether mount_fdesc is used
>Number: 60008
>Category: toolchain
>Synopsis: MAKEDEV should let caller say whether mount_fdesc is used
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 15 20:55:00 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
The MetaFD Foundation, Inc.
>Environment:
>Description:
The MAKEDEV script examines whether the working directory has
fdescfs mounted, but this doesn't make sense when running it at
build-time to create images with, e.g.,
src/embedded/utils/mkimage:
516 # Set fdesc_mounted=true if the fdesc file system is mounted
517 # on the current directory (typically "/dev").
518 # Later, this will be used to suppress creation of device nodes
519 # that are supplied by the fdesc file system.
520 #
521 fdesc_mounted=false
522 if [ -d fd ]; then
523 # Parse the output from "mount -u -o nosuchoption .".
524 # We don't parse the output from df(1) because that's
525 # less likely to be available on install media.
526 #
527 # If the current directory is a mount point for the
528 # fdesc file system, then the expected output (whether
529 # or not the current user is root) is:
530 # mount_fdesc: -o suchoption: option not supported.
531 #
532 # If the current directory is not a mount point, then
533 # the expected output is:
534 # mount: .: unknown special file or file system.
535 #
536 # If we are not running on NetBSD, or mount(8) is not
537 # found, then we should get some other error message.
538 #
539 case "$({ LC_ALL=C mount -u -o nosuchoption . ; } 2>&1)" in
540 *mount_fdesc*) fdesc_mounted=true ;;
541 esac
542 fi
https://nxr.netbsd.org/xref/src/etc/MAKEDEV.tmpl?r=1.238#516
MAKEDEV does this in order to make some decisions about which
device nodes to create:
960 std)
...
973 if ! $fdesc_mounted; then
974 mkdev tty c %ctty_chr% 0 666
975 mkdev stdin c %filedesc_chr% 0 666
976 mkdev stdout c %filedesc_chr% 1 666
977 mkdev stderr c %filedesc_chr% 2 666
978 fi
https://nxr.netbsd.org/xref/src/etc/MAKEDEV.tmpl?r=1.238#960
1158 fd)
1159 if ! $fdesc_mounted; then
1160 # Create the "fd" subdirectory, and devices "fd/0" to "fd/63"
1161 makedir fd 755
1162 n=0
1163 while [ $n -lt 64 ]
1164 do
1165 mkdev fd/$n c %filedesc_chr% $n 666
1166 n=$(($n + 1))
1167 done
1168 fi
https://nxr.netbsd.org/xref/src/etc/MAKEDEV.tmpl?r=1.238#1158
>How-To-Repeat:
Try to build an image with mkimage that is appropriate for
having fdescfs mounted.
>Fix:
These decisions should be configurable by a command-line option
so they can be independent of whatever file systems are mounted
at build-time.
While it may not exactly hurt for the extra device nodes to
exist on disk even if fdescfs will later be mounted over them
(other than costing a few dozen inodes), the behaviour of
MAKEDEV as a build-time tool should not depend on mounted file
systems and should be controllable by command-line options.
Home |
Main Index |
Thread Index |
Old Index