Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 107572 - bctool uses hardcoded location for mkfs.msdos
Summary: bctool uses hardcoded location for mkfs.msdos
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High major
Assignee: Crypto team [DISABLED]
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-29 01:56 UTC by Alexander Wigen
Modified: 2005-11-12 18:47 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild that links in mkfs.msdos mkfs.vfat mkfs.ntfs to /sbin (dosfstools-2.11-r1.ebuild,1.22 KB, text/plain)
2005-10-01 22:54 UTC, Alexander Wigen
Details
bestcrypt-1.6_p1-mkfs-path.diff (bestcrypt-1.6_p1-mkfs-path.diff,1.30 KB, patch)
2005-10-03 11:11 UTC, Marcelo Goes (RETIRED)
Details | Diff
bestcrypt-1.6_p1-mkfs-path.diff (bestcrypt-1.6_p1-mkfs-path.diff,1.53 KB, patch)
2005-10-03 11:17 UTC, Marcelo Goes (RETIRED)
Details | Diff
bestcrypt-1.6_p2-mkfs-path.diff (bestcrypt-1.6_p2-mkfs-path.diff,347 bytes, patch)
2005-11-12 08:06 UTC, Alexander Wigen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Wigen 2005-09-29 01:56:01 UTC
Bug:   
bctool uses hardcoded location for mkfs.msdos and sys-fs/dosfstools puts the  
binary in another location.  
  
 
Fix:  
Alternative 1: (prefered)  
Make the sys-fs/dosfstools ebuild link the binaries to /sbin where the other  
mkfs utils are:  
ln -s /usr/sbin/mkfs.msdos /sbin  
ln -s /usr/sbin/mkfs.vfat /sbin  
ln -s /usr/sbin/mkfs.ntfs /sbin  
  
Alternative 2:  
Patch bctool to look in /usr/sbin.  

Reproducible: Always
Steps to Reproduce:
1. emerge bestcrypt dosfstools  
2. bctool new -s 10M -t vfat test.jbc -a blowfish  
3. bcformat -t vfat -a blowfish test.jbc  
 
Actual Results:  
Error: mkfs.msdos not found  

Expected Results:  
bctool should find the mkfs binary and format the container.
Comment 1 Marcelo Goes (RETIRED) gentoo-dev 2005-09-29 11:40:14 UTC
base-system: which do you recommend?
I can look into patching app-crypt/bestcrypt if necessary.
Comment 2 SpanKY gentoo-dev 2005-09-29 12:48:03 UTC
bctool should be smart enough to search $PATH and fall back to hardcoded paths
Comment 3 Marcelo Goes (RETIRED) gentoo-dev 2005-10-01 15:49:37 UTC
I tried this in bcformat.c:

	if (stat("/sbin/mkfs.msdos", &mkfs_path) == -1 && errno == ENOENT)
	{
		command[0]="/usr/sbin/mkfs";
	}
	else
	{
		command[0]="/sbin/mkfs";
	}

For some reason, when I run it I get "execve /usr/sbin/mkfs failed: No such file
or directory". Don't know why it is not picking up the .msdos thing...
Comment 4 Alexander Wigen 2005-10-01 20:56:56 UTC
(In reply to comment #3) 
> For some reason, when I run it I get "execve /usr/sbin/mkfs failed: No such 
file 
> or directory". Don't know why it is not picking up the .msdos thing... 
 
Because execve() is being told to run /usr/sbin/mkfs -t vfat <args> 
not /usr/sbin/mkfs.vfat <args>. The mkfs binary is located in /sbin and will 
try  to run the mkfs.<fstype> when it is called this is why the better approach 
will be to link in the dosfstool's to the /sbin directory. Not doing so breaks 
mkfs. 
Comment 5 Alexander Wigen 2005-10-01 22:54:30 UTC
Created attachment 69684 [details]
ebuild that links in mkfs.msdos mkfs.vfat mkfs.ntfs to /sbin

New ebuild for dosfstools that links in mkfs.msdos mkfs.vfat mkfs.ntfs to /sbin


"mkfs -t {vfat,msdos,ntfs}" is currently broken, this fixes it.
Comment 6 Brian Harring (RETIRED) gentoo-dev 2005-10-01 23:01:06 UTC
This is in no way portage's domain... it's the crypto herd's, leave it assigned
to them (they're the ones responsible for it). :)
Comment 7 SpanKY gentoo-dev 2005-10-03 06:05:46 UTC
stop screwing around with the assigned field
Comment 8 Marcelo Goes (RETIRED) gentoo-dev 2005-10-03 11:11:39 UTC
Created attachment 69799 [details, diff]
bestcrypt-1.6_p1-mkfs-path.diff

Mind testing this patch?
Comment 9 Marcelo Goes (RETIRED) gentoo-dev 2005-10-03 11:17:57 UTC
Created attachment 69802 [details, diff]
bestcrypt-1.6_p1-mkfs-path.diff
Comment 10 Alexander Wigen 2005-10-03 18:23:44 UTC
(In reply to comment #9) 
> Created an attachment (id=69802) [edit] 
> bestcrypt-1.6_p1-mkfs-path.diff 
>  
 
Just to be picky, there is the case of mkfs.ntfs. 
 
If you look at line 226 of misc.c: 
    char *env[] = { "PATH=/sbin", NULL}; 
 
Would it not be enough to include /usr/sbin in the environment to execve? 
 
Cheers 
Alexander Wigen 
Comment 11 Marcelo Goes (RETIRED) gentoo-dev 2005-10-03 19:21:41 UTC
That is probably a much better solution. I was trying to mess as little as
possible with it, but made a nasty patch.

Oh well. I'll give it a try asap...
Comment 12 Daniel Black (RETIRED) gentoo-dev 2005-11-10 11:27:37 UTC
I think this is fixed in 1.6_p2 as it no longer forces the environment in 
misc.c. 
 
Please confirm. 
Comment 13 Alexander Wigen 2005-11-11 00:23:50 UTC
(In reply to comment #12)  
> I think this is fixed in 1.6_p2 as it no longer forces the environment in   
> misc.c.   
>    
> Please confirm. 
 
I can confirm that this is _NOT_ fixed in 1.6_p2  
 
The steps listed in the initial bug report still produce the same output. 
Comment 14 Daniel Black (RETIRED) gentoo-dev 2005-11-12 02:02:33 UTC
Alexander - I've applied your fix from comment 10. Must of been reading the 
wrong file before. 
 
I had some trouble testing it. SEGVs and the such. Can you please confirm if 
it works or not. 
 
Is this an issue? 
   
http://www.jetico.com/linux/bcrypt-help/l_probl.htm#udev   
   
my permissions:   
brw-rw----  1 root disk 188,  0 Nov 12 20:13 /dev/bcrypt0   
brw-rw----  1 root disk 188,  1 Nov 12 20:13 /dev/bcrypt1   
brw-rw----  1 root disk 188, 10 Nov 12 20:13 /dev/bcrypt10   
brw-rw----  1 root disk 188, 11 Nov 12 20:13 /dev/bcrypt11   
brw-rw----  1 root disk 188, 12 Nov 12 20:13 /dev/bcrypt12   
brw-rw----  1 root disk 188, 13 Nov 12 20:13 /dev/bcrypt13   
brw-rw----  1 root disk 188, 14 Nov 12 20:13 /dev/bcrypt14   
brw-rw----  1 root disk 188, 15 Nov 12 20:13 /dev/bcrypt15   
brw-rw----  1 root disk 188,  2 Nov 12 20:13 /dev/bcrypt2   
brw-rw----  1 root disk 188,  3 Nov 12 20:13 /dev/bcrypt3   
brw-rw----  1 root disk 188,  4 Nov 12 20:13 /dev/bcrypt4   
brw-rw----  1 root disk 188,  5 Nov 12 20:13 /dev/bcrypt5   
brw-rw----  1 root disk 188,  6 Nov 12 20:13 /dev/bcrypt6   
brw-rw----  1 root disk 188,  7 Nov 12 20:13 /dev/bcrypt7   
brw-rw----  1 root disk 188,  8 Nov 12 20:13 /dev/bcrypt8   
brw-rw----  1 root disk 188,  9 Nov 12 20:13 /dev/bcrypt9   
 
if so I'll add a /etc/udev/rules.d files. 
 
The init script is really rough. Suggestions welcome. 
Comment 15 Alexander Wigen 2005-11-12 08:06:10 UTC
Created attachment 72755 [details, diff]
bestcrypt-1.6_p2-mkfs-path.diff

This set's the environment variable (PATH) to search /usr/sbin as well. Note
setting the variable to PATH=/sbin:/usr/sbin does not work but
PATH=/usr/sbin:/sbin does, why?

This patch is tested and works for me.
Comment 16 Daniel Black (RETIRED) gentoo-dev 2005-11-12 16:45:01 UTC
does it still work for ext2 and other /sbin mkfs filesystems? 
Comment 17 Alexander Wigen 2005-11-12 18:47:29 UTC
(In reply to comment #16) 
> does it still work for ext2 and other /sbin mkfs filesystems?  
 
It works with ext2, ext3 and all filesystems I have mkfs' for in /sbin except 
cramfs which needs extra parameters. 
 
Cheers 
Alex