Jack Kelly
2013-Apr-17 20:37 UTC
[syslinux] Confusing error message when pointing the linux installer at a missing directory.
Last night, I was trying to install syslinux (5.01) to a SD card of mine, writing to a subdirectory to keep the layout neat: syslinux-5.01/linux# ./syslinux -i -d /boot /dev/mmcblk0p1 /dev/mmcblk0p1: No such file or directory The message is coming from do_open_file() in syslinux.c: the call to open() fails because the containing directory isn't present, and then it calls perror(opt.device). If the directory is present, syslinux installs and will boot. It's just a matter of either improving the error message or trying to make the directory before populating it. -- Jack
Regid Ichira
2013-Apr-17 23:06 UTC
[syslinux] [extlinux] Confusing error message when pointing to a ro fs
On Thu, Apr 18, 2013 at 06:37:49AM +1000, Jack Kelly wrote:> Last night, I was trying to install syslinux (5.01) to a SD card of > mine, writing to a subdirectory to keep the layout neat: > > syslinux-5.01/linux# ./syslinux -i -d /boot /dev/mmcblk0p1 > /dev/mmcblk0p1: No such file or directory > > The message is coming from do_open_file() in syslinux.c: the call to > open() fails because the containing directory isn't present, and then it > calls perror(opt.device). > > If the directory is present, syslinux installs and will boot. It's just > a matter of either improving the error message or trying to make the > directory before populating it. >Package: extlinux Version: 2:4.05+dfsg-6+deb7u1 I think the same error message is printed when extlinux is trying to use a read only file system. Maybe that message should also be improved. 2:4.05+dfsg-6+deb7u1 is from debian. Even though debian seem to change the source code, I think the relevant code is not different from upstream.
Matt Fleming
2013-Apr-25 14:29 UTC
[syslinux] Confusing error message when pointing the linux installer at a missing directory.
On 04/17/2013 09:37 PM, Jack Kelly wrote:> Last night, I was trying to install syslinux (5.01) to a SD card of > mine, writing to a subdirectory to keep the layout neat: > > syslinux-5.01/linux# ./syslinux -i -d /boot /dev/mmcblk0p1 > /dev/mmcblk0p1: No such file or directory > > The message is coming from do_open_file() in syslinux.c: the call to > open() fails because the containing directory isn't present, and then it > calls perror(opt.device). > > If the directory is present, syslinux installs and will boot. It's just > a matter of either improving the error message or trying to make the > directory before populating it.Thanks for the report, I queued up the following patch. Note it will print something like, /tmp/syslinux.XXX/boot/ldlinux.sys: No such file or directory which still isn't entirely clear, but is at least more helpful than what we have currently. --->From faff52ef2bd3dca503a6fef3129f02284e9b6ca4 Mon Sep 17 00:00:00 2001From: Matt Fleming <matt.fleming at intel.com> Date: Thu, 25 Apr 2013 15:14:18 +0100 Subject: [PATCH] linux: Clear up error message Passing opt.device to perror() in do_open_file() results in confusing error messages, as Jack reports, Last night, I was trying to install syslinux (5.01) to a SD card of mine, writing to a subdirectory to keep the layout neat: syslinux-5.01/linux# ./syslinux -i -d /boot /dev/mmcblk0p1 /dev/mmcblk0p1: No such file or directory The message is coming from do_open_file() in syslinux.c: the call to open() fails because the containing directory isn't present, and then it calls perror(opt.device). We should instead be passing 'name' to perror() so that we know _which_ file doesn't exist. Reported-by: Jack Kelly <jack at jackkelly.name> Signed-off-by: Matt Fleming <matt.fleming at intel.com> --- linux/syslinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/syslinux.c b/linux/syslinux.c index f4749ea..f64834b 100755 --- a/linux/syslinux.c +++ b/linux/syslinux.c @@ -251,7 +251,7 @@ int do_open_file(char *name) unlink(name); fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0444); if (fd < 0) - perror(opt.device); + perror(name); return fd; } -- 1.8.1.4 -- Matt Fleming, Intel Open Source Technology Center