[PATCH] busybox: fix mkdir -p on read only file systems

Denys Vlasenko vda.linux at googlemail.com
Thu May 15 19:26:12 UTC 2008


On Wednesday 14 May 2008 11:19, Peter Korsgaard wrote:
> From: Peter Korsgaard <jacmet at sunsite.dk>
> 
> Read only file systems return EROFS on mkdir() even if the directory exists.
> Update the check in bb_make_directory to handle EROFS like EEXIST.

Why?

Unlike "directory already exists", "read-only fs" is the real error
in real-world usage - user won't be able to create files in it later.

Coreutils treat EROFS as an error, and bbox matches that:

# /usr/bin/mkdir /ertwertwetr; echo $?
/usr/bin/mkdir: cannot create directory `/ertwertwetr': Read-only file system
1
# mkdir /ertwertwetr; echo $?
mkdir: cannot create directory '/ertwertwetr': Read-only file system
1
# /usr/bin/mkdir -p /ertwertwetr; echo $?
/usr/bin/mkdir: cannot create directory `/ertwertwetr': Read-only file system
1
# mkdir -p /ertwertwetr; echo $?
mkdir: cannot create directory '/ertwertwetr': Read-only file system
1
# ls -l /usr/bin/mkdir
lrwxrwxrwx    1 root     root           32 Feb 28 12:22 /usr/bin/mkdir -> /usr/app/coreutils-6.9/bin/mkdir
# mkdir --help
BusyBox v1.10.0 (2008-03-22 15:35:10 CET) multi-call binary
...


Do you have an example where behavior differs?
--
vda



More information about the busybox mailing list