Debian Bug report logs - #609052
freebsd-utils: mount/umount have 80/85 character path limit breaking mounting

version graph

Package: schroot; Maintainer for schroot is Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>; Source for schroot is src:schroot.

Reported by: Jakub Wilk <jwilk@debian.org>

Date: Thu, 30 Dec 2010 20:09:02 UTC

Severity: serious

Tags: fixed-upstream, patch

Merged with 609108

Fixed in version schroot/1.4.18-1

Done: Roger Leigh <rleigh@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, jwilk@debian.org, debian-bsd@lists.debian.org, Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>:
Bug#608428; Package schroot. (Thu, 30 Dec 2010 20:09:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Wilk <jwilk@debian.org>:
New Bug report received and forwarded. Copy sent to jwilk@debian.org, debian-bsd@lists.debian.org, Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>. (Thu, 30 Dec 2010 20:09:05 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Jakub Wilk <jwilk@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Thu, 30 Dec 2010 21:06:28 +0100
Package: schroot
Version: 1.4.16-1
Severity: important

On kfreebsd-*, schroot is not able to unmount everything if chroot name 
is longer than 13 characters:

# schroot -c 123456789abcde echo Hello world
Hello world
E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0/dev/f failed: Invalid argument
E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0/dev failed: Device or resource busy
E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0 failed: Device or resource busy
E: 10mount: rmdir: failed to remove `/var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0': Device or resource busy
E: 123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0: Chroot setup failed: stage=setup-stop


If the name is longer than 18 characters, it cannot even run a command:

# schroot -c 123456789abcdefghij echo Hello world
E: 10mount: mount: dev : File name too long
E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca/ failed: Invalid argument
E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca/ failed: Invalid argument
E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca failed: Device or resource busy
E: 10mount: rmdir: failed to remove `/var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca': Device or resource busy
E: 123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca: Chroot setup failed: stage=setup-start


Given that e.g. sbuild-createchroot creates chroot named 
"$SUITE-kfreebsd-$CPU-sbuild" (which is >= 23 characters), this is quite 
an unfortunate limitation.

Also, please don't try my examples at home, because the only way to 
unmount stuff mounted by schroot seems to be: put SESSIONS_RECOVER="end" 
into /etc/default/schroot and reboot. :/

(debian-bsd@lists.debian.org CC-ed.)


-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: kfreebsd-i386 (i686)

Kernel: kFreeBSD 8.1-1-686
Locale: LANG=C, LC_CTYPE=pl_PL.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash

Versions of packages schroot depends on:
ii  libboost-filesystem1.42.0     1.42.0-4   filesystem operations (portable pa
ii  libboost-program-options1.42. 1.42.0-4   program options library for C++
ii  libboost-regex1.42.0          1.42.0-4   regular expression library for C++
ii  libboost-system1.42.0         1.42.0-4   Operating system (e.g. diagnostics
ii  libc0.1                       2.11.2-7   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.5-10 GCC support library
ii  liblockdev1                   1.0.3-1.4  Run-time shared library for lockin
ii  libpam0g                      1.1.1-6.1  Pluggable Authentication Modules l
ii  libstdc++6                    4.4.5-10   The GNU Standard C++ Library v3
ii  libuuid1                      2.17.2-5   Universally Unique ID library
ii  schroot-common                1.4.16-1   common files for schroot

schroot recommends no packages.

Versions of packages schroot suggests:
pn  aufs-modules | unionfs-module <none>     (no description available)
pn  btrfs-tools                   <none>     (no description available)
ii  debootstrap                   1.0.26     Bootstrap a basic Debian system
pn  lvm2                          <none>     (no description available)
pn  unzip                         <none>     (no description available)

-- 
Jakub Wilk




Information forwarded to debian-bugs-dist@lists.debian.org, Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>:
Bug#608428; Package schroot. (Thu, 30 Dec 2010 22:21:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roger Leigh <rleigh@codelibre.net>:
Extra info received and forwarded to list. Copy sent to Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>. (Thu, 30 Dec 2010 22:21:03 GMT) Full text and rfc822 format available.

Message #10 received at 608428@bugs.debian.org (full text, mbox):

From: Roger Leigh <rleigh@codelibre.net>
To: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org
Cc: debian-bsd@lists.debian.org
Subject: Re: [buildd-tools-devel] Bug#608428: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Thu, 30 Dec 2010 22:18:27 +0000
[Message part 1 (text/plain, inline)]
On Thu, Dec 30, 2010 at 09:06:28PM +0100, Jakub Wilk wrote:

Hi Jakub,

> On kfreebsd-*, schroot is not able to unmount everything if chroot name  
> is longer than 13 characters:
>
> # schroot -c 123456789abcde echo Hello world
> Hello world
> E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0/dev/f failed: Invalid argument
>
> If the name is longer than 18 characters, it cannot even run a command:
>
> # schroot -c 123456789abcdefghij echo Hello world
> E: 10mount: mount: dev : File name too long
> E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca/ failed: Invalid argument
>
> Given that e.g. sbuild-createchroot creates chroot named  
> "$SUITE-kfreebsd-$CPU-sbuild" (which is >= 23 characters), this is quite  
> an unfortunate limitation.

Yes, it is.  Given that schroot only runs the system's standard
"mount" and "umount" commands, is this an underlying limitation in
either those commands or in the system calls?  Or in the shell?

The mount(2) manpage for freebsd indicates that 1023 characters is the
maximum length, with 255 characters the limit for a single path
component.  It doesn't look like that's an issue (though you are getting
ENAMETOOLONG in your second example).  The initial error in your
examples is mount/umount returning EINVAL, which the manpage says means
"The super block for the filesystem had a bad magic number or an out of
range block size."

It would be useful to run the above commands with
"--verbose --debug=notice" so that we can see exactly what's going on.
If the path is getting truncated or mangled, that should show up.
This might not be sufficient to get the exact mount commands; running
as root "strace -f -o $log" might do that better.

> Also, please don't try my examples at home, because the only way to  
> unmount stuff mounted by schroot seems to be: put SESSIONS_RECOVER="end"  
> into /etc/default/schroot and reboot. :/

I'm afraid I don't have a kfreebsd installation to test on right now,
and I haven't used it before.  While I'm sure I can set one up in kvm,
this appears (at least at first glance) to be [k]freebsd-specific
since we haven't run into this problem on Linux in the 5½ years I've
been maintaining schroot.  If anyone with specific BSD knowledge
could provide some more detailed investigation, that would be great.

In particular, do you run into failures if you manually mount/umount
progressively longer paths?  In the examples above, it looks like the
lengths are around 80 chars unless they were clipped, and that's far
too short.

Also, it's weird it umounts on reboot.  The schroot init script
simply calls "schroot --end-session $session" for each open
session; which just runs the umount commands in the 10mount setup
script like above.  It's odd that it's failing when run by the
user and not when run by the setup script, since both do exactly
the same thing.  Maybe worth trying to manually create a session
with --begin-session/--run-session/--end-session and compare the
behaviour with automatically running a command (the default
behaviour).  Again, there shouldn't be a difference, but is worth
looking at in case there's something odd going on there (possibly
the case if it's writing out something odd into the session file,
but very unlikely).


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>:
Bug#608428; Package schroot. (Sat, 01 Jan 2011 14:45:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roger Leigh <rleigh@codelibre.net>:
Extra info received and forwarded to list. Copy sent to Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>. (Sat, 01 Jan 2011 14:45:06 GMT) Full text and rfc822 format available.

Message #15 received at 608428@bugs.debian.org (full text, mbox):

From: Roger Leigh <rleigh@codelibre.net>
To: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org
Cc: debian-bsd@lists.debian.org
Subject: Re: [buildd-tools-devel] Bug#608428: Bug#608428: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Sat, 1 Jan 2011 14:42:08 +0000
[Message part 1 (text/plain, inline)]
reassign 608428 freebsd-utils
severity 608428 serious
thanks

On Thu, Dec 30, 2010 at 10:18:27PM +0000, Roger Leigh wrote:
> On Thu, Dec 30, 2010 at 09:06:28PM +0100, Jakub Wilk wrote:
> 
> Hi Jakub,
> 
> > On kfreebsd-*, schroot is not able to unmount everything if chroot name  
> > is longer than 13 characters:
> >
> > # schroot -c 123456789abcde echo Hello world
> > Hello world
> > E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0/dev/f failed: Invalid argument
> >
> > If the name is longer than 18 characters, it cannot even run a command:
> >
> > # schroot -c 123456789abcdefghij echo Hello world
> > E: 10mount: mount: dev : File name too long
> > E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca/ failed: Invalid argument
> >
> > Given that e.g. sbuild-createchroot creates chroot named  
> > "$SUITE-kfreebsd-$CPU-sbuild" (which is >= 23 characters), this is quite  
> > an unfortunate limitation.
> 
> Yes, it is.  Given that schroot only runs the system's standard
> "mount" and "umount" commands, is this an underlying limitation in
> either those commands or in the system calls?  Or in the shell?

I've created a kfreebsd install using kvm, and installed sbuild and
schroot in it, and I have reproduced the problem.

The bug is not in sbuild; it's reproducible with schroot alone as you
saw.

The bug is not in schroot; it's reproducible with the plain
mount/umount commands and long paths, shown below.

root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; mkdir  /tmp/$cs; mount -v -t linprocfs linprocfs /tmp/$cs; done
linprocfs on /tmp/0 (linprocfs, local)
linprocfs on /tmp/01 (linprocfs, local)
linprocfs on /tmp/012 (linprocfs, local)
linprocfs on /tmp/0123 (linprocfs, local)
linprocfs on /tmp/01234 (linprocfs, local)
linprocfs on /tmp/012345 (linprocfs, local)
linprocfs on /tmp/0123456 (linprocfs, local)
linprocfs on /tmp/01234567 (linprocfs, local)
linprocfs on /tmp/012345678 (linprocfs, local)
linprocfs on /tmp/0123456789 (linprocfs, local)
linprocfs on /tmp/0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789ab (linprocfs, local)
linprocfs on /tmp/0123456789abc (linprocfs, local)
linprocfs on /tmp/0123456789abcd (linprocfs, local)
linprocfs on /tmp/0123456789abcde (linprocfs, local)
linprocfs on /tmp/0123456789abcdef (linprocfs, local)
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; mkdir /tmp/$cs; mount -v -t linprocfs linprocfs /tmp/$cs; done
linprocfs on /tmp/0123456789abcdef0 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef01 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef012 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef01234 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef012345 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef01234567 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef012345678 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789ab (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abc (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcd (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcde (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef (linprocfs, local)
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; mkdir /tmp/$cs; mount -v -t linprocfs linprocfs /tmp/$cs; done
linprocfs on /tmp/0123456789abcdef0123456789abcdef0 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef01 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef012 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef01234 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef012345 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef01234567 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef012345678 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789ab (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abc (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcd (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcde (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef (linprocfs, local)
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; mkdir /tmp/$cs; mount -v -t linprocfs linprocfs /tmp/$cs; done
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef01 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef012 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef01234 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef012345 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef01234567 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef012345678 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abc (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef (linprocfs, local)
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; mkdir /tmp/$cs; mount -v -t linprocfs linprocfs /tmp/$cs; done
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789 (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)

Notice here that the paths start getting clipped at the 80 character
path length.  Note that although the displayed path is clipped, and
it's reported in clipped form by mount, it's actually correctly mounted
(see below).

If we increase the path length yet further (>85 chars), it then fails
with ENAMETOOLONG:

root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; mkdir /tmp/$cs; mount -v -t linprocfs linprocfs /tmp/$cs; done
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long
mount: linprocfs : File name too long

Unmounting is broken as well:

root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; umount -v /tmp/$cs; done
linprocfs: unmount from /tmp/0
linprocfs: unmount from /tmp/01
linprocfs: unmount from /tmp/012
linprocfs: unmount from /tmp/0123
linprocfs: unmount from /tmp/01234
linprocfs: unmount from /tmp/012345
linprocfs: unmount from /tmp/0123456
linprocfs: unmount from /tmp/01234567
linprocfs: unmount from /tmp/012345678
linprocfs: unmount from /tmp/0123456789
linprocfs: unmount from /tmp/0123456789a
linprocfs: unmount from /tmp/0123456789ab
linprocfs: unmount from /tmp/0123456789abc
linprocfs: unmount from /tmp/0123456789abcd
linprocfs: unmount from /tmp/0123456789abcde
linprocfs: unmount from /tmp/0123456789abcdef
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; umount -v /tmp/$cs; done
linprocfs: unmount from /tmp/0123456789abcdef0
linprocfs: unmount from /tmp/0123456789abcdef01
linprocfs: unmount from /tmp/0123456789abcdef012
linprocfs: unmount from /tmp/0123456789abcdef0123
linprocfs: unmount from /tmp/0123456789abcdef01234
linprocfs: unmount from /tmp/0123456789abcdef012345
linprocfs: unmount from /tmp/0123456789abcdef0123456
linprocfs: unmount from /tmp/0123456789abcdef01234567
linprocfs: unmount from /tmp/0123456789abcdef012345678
linprocfs: unmount from /tmp/0123456789abcdef0123456789
linprocfs: unmount from /tmp/0123456789abcdef0123456789a
linprocfs: unmount from /tmp/0123456789abcdef0123456789ab
linprocfs: unmount from /tmp/0123456789abcdef0123456789abc
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcd
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcde
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; umount -v /tmp/$cs; done
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef01
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef012
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef01234
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef012345
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef01234567
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef012345678
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789a
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789ab
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abc
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcd
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcde
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; umount -v /tmp/$cs; done
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef01
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef012
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef01234
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef012345
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef01234567
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef012345678
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789a
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abc
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; umount -v /tmp/$cs; done
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789
linprocfs: unmount from /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a
umount: unmount of /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a failed: Invalid argument
umount: unmount of /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a failed: Invalid argument
umount: unmount of /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a failed: Invalid argument
umount: unmount of /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a failed: Invalid argument
umount: unmount of /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a failed: Invalid argument

As before, the path gets clipped at 80 chars, and umount fails to
umount the truncated path.

Again, as we get to >85 chars, it fails outright:

root@kfreebsd:~# for c in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do cs="$cs$c"; umount -v /tmp/$cs; done
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abc: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde: not a file system root directory
umount: /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef: not a file system root directory


Mount reports truncated paths.  These are the remaining mounts after
running the above commands.  These are paths from 80-85 chars since <80
mount/umount OK, and >85 fail.  80-85 lengths mount OK even though
reported incorrectly, but fail to umount:

root@kfreebsd:~# mount | grep /tmp
linprocfs on /tmp/var/lib/schroot/mount/kfreebsd-amd64-sbuild-xxxxxxxx0xxxx0xxxx0xxxx0xxxxxxx (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)
linprocfs on /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789a (linprocfs, local)

But, if we look at /proc/mounts in linprocfs, we do see the full
non-clipped path!

root@kfreebsd:~# cat /proc/mounts | grep /tmp
linprocfs /tmp/var/lib/schroot/mount/kfreebsd-amd64-sbuild-xxxxxxxx0xxxx0xxxx0xxxx0xxxxxxx/proc linprocfs rw 0 0
linprocfs /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab linprocfs rw 0 0
linprocfs /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abc linprocfs rw 0 0
linprocfs /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd linprocfs rw 0 0
linprocfs /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde linprocfs rw 0 0
linprocfs /tmp/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef linprocfs rw 0 0


So, this looks like a bug in the mount/umount utilities and/or the
kfreebsd mount/nmount/umount system calls.

Possible explanation: there's an 80 char buffer being used which causes
the truncation.  The syscall manual pages tell us that there's a 1023
character restriction with 255 chars per path component.  We're nowhere
near that documented limit, so there's a serious bug somewhere.


I'm not a freebsd user or developer.  I've identified the cause of the
problem, and it's not in schroot.  This really needs the attention of
some freebsd people who can fix the length restrictions, I've
realistically done all I am able.

I've reassigned this to freebsd-utils, which is the most likely place
for the bug to be.  I've also put the severity to serious, since this
is a fundamental and dangerous flaw in a key system component which
can and is causing breakage.  It would be good if this could be
fixed for squeeze.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
[signature.asc (application/pgp-signature, inline)]

Bug reassigned from package 'schroot' to 'freebsd-utils'. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Sat, 01 Jan 2011 14:45:08 GMT) Full text and rfc822 format available.

Bug No longer marked as found in versions schroot/1.4.16-1. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Sat, 01 Jan 2011 14:45:08 GMT) Full text and rfc822 format available.

Severity set to 'serious' from 'important' Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Sat, 01 Jan 2011 14:45:09 GMT) Full text and rfc822 format available.

Changed Bug title to 'freebsd-utils: mount/umount have 80/85 character path limit breaking mounting' from 'schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names' Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Sat, 01 Jan 2011 15:03:03 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>:
Bug#608428; Package freebsd-utils. (Sat, 01 Jan 2011 18:12:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>. (Sat, 01 Jan 2011 18:12:03 GMT) Full text and rfc822 format available.

Message #28 received at 608428@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: Roger Leigh <rleigh@codelibre.net>
Cc: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org, control@bugs.debian.org
Subject: Re: [buildd-tools-devel] Bug#608428: Bug#608428: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Sat, 1 Jan 2011 19:11:41 +0100 (CET)
severity 608428 important
user debian-bsd@lists.debian.org
usertag 608428 + kfreebsd
--

> So, this looks like a bug in the mount/umount utilities and/or the
> kfreebsd mount/nmount/umount system calls.
>
> Possible explanation: there's an 80 char buffer being used which causes
> the truncation.  The syscall manual pages tell us that there's a 1023
> character restriction with 255 chars per path component.  We're nowhere
> near that documented limit, so there's a serious bug somewhere.
>
> I'm not a freebsd user or developer.  I've identified the cause of the
> problem, and it's not in schroot.  This really needs the attention of
> some freebsd people who can fix the length restrictions, I've
> realistically done all I am able.

Many thanks for this.

> I've reassigned this to freebsd-utils, which is the most likely place
> for the bug to be.  I've also put the severity to serious, since this
> is a fundamental and dangerous flaw in a key system component which
> can and is causing breakage.  It would be good if this could be
> fixed for squeeze.

There is a system limit in

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/mount.h

#define MNAMELEN        88              /* size of on/from name bufs */

We cannot do much with this limit :-(

Petr






Severity set to 'important' from 'serious' Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Sat, 01 Jan 2011 18:12:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>:
Bug#608428; Package freebsd-utils. (Sat, 01 Jan 2011 18:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roger Leigh <rleigh@codelibre.net>:
Extra info received and forwarded to list. Copy sent to GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>. (Sat, 01 Jan 2011 18:15:03 GMT) Full text and rfc822 format available.

Message #35 received at 608428@bugs.debian.org (full text, mbox):

From: Roger Leigh <rleigh@codelibre.net>
To: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org
Cc: debian-bsd@lists.debian.org
Subject: Re: Bug #608428: freebsd-utils: mount/umount have 80/85 character path limit breaking mounting
Date: Sat, 1 Jan 2011 18:11:02 +0000
[Message part 1 (text/plain, inline)]
forwarded 608428 http://www.freebsd.org/cgi/query-pr.cgi?pr=153600
thanks

This is also reproducible on vanilla FreeBSD (I tested 8.2-RC1),
though the 80-84 character behaviour is absent (only breaks after
85 characters).  The test was done using the following shell
script.

#!/bin/sh

chrs="0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f"

for c in $chrs; do
  cs="$cs$c"
  dir="/tmp/$cs"
  echo "Testing $cs ($(echo -n "$dir" | wc -c) chars)"
  mkdir "$dir"
  mount -v -t linprocfs linprocfs "$dir"
  umount -v "$dir"
  rmdir "$dir"
done


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
[signature.asc (application/pgp-signature, inline)]

Set Bug forwarded-to-address to 'http://www.freebsd.org/cgi/query-pr.cgi?pr=153600'. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Sat, 01 Jan 2011 18:15:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>:
Bug#608428; Package freebsd-utils. (Sat, 01 Jan 2011 18:33:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roger Leigh <rleigh@codelibre.net>:
Extra info received and forwarded to list. Copy sent to GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>. (Sat, 01 Jan 2011 18:33:03 GMT) Full text and rfc822 format available.

Message #42 received at 608428@bugs.debian.org (full text, mbox):

From: Roger Leigh <rleigh@codelibre.net>
To: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org
Subject: Re: [buildd-tools-devel] Bug#608428: Bug#608428: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Sat, 1 Jan 2011 18:29:17 +0000
[Message part 1 (text/plain, inline)]
On Sat, Jan 01, 2011 at 07:11:41PM +0100, Petr Salinger wrote:
> severity 608428 important
> user debian-bsd@lists.debian.org
> usertag 608428 + kfreebsd
> --
>
>> So, this looks like a bug in the mount/umount utilities and/or the
>> kfreebsd mount/nmount/umount system calls.
>>
>> Possible explanation: there's an 80 char buffer being used which causes
>> the truncation.  The syscall manual pages tell us that there's a 1023
>> character restriction with 255 chars per path component.  We're nowhere
>> near that documented limit, so there's a serious bug somewhere.
>
>> I've reassigned this to freebsd-utils, which is the most likely place
>> for the bug to be.  I've also put the severity to serious, since this
>> is a fundamental and dangerous flaw in a key system component which
>> can and is causing breakage.  It would be good if this could be
>> fixed for squeeze.
>
> There is a system limit in
>
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/mount.h
>
> #define MNAMELEN        88              /* size of on/from name bufs */
>
> We cannot do much with this limit :-(

Thanks for the information.

That's unfortunate--I imagine simply changing it would break ABI
quite badly?  Is the use of statfs widespread beyond the core
system components such as mount etc.?

Looking at the Linux equivalents in <bits/statfs.h>, these versions
simply don't include any fixed-length character arrays and so avoid
the problem entirely.

It's really rather odd that the userspace structures (assuming FreeBSD
doesn't use the same header for the kernel too, which I'm not sure is
right) have such inconsistent and restrictive lengths compared with
what's technically permitted by the actual mount/umount system calls.

From the schroot perspective, I can mitigate this a bit by using
shorter session names without using UUIDs, but this is only masking
the problem--it'll occasionally break when users want to mount things
deeper inside the chroot environment.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>:
Bug#608428; Package freebsd-utils. (Sat, 01 Jan 2011 18:57:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>. (Sat, 01 Jan 2011 18:57:06 GMT) Full text and rfc822 format available.

Message #47 received at 608428@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: Roger Leigh <rleigh@codelibre.net>
Cc: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org
Subject: Re: [buildd-tools-devel] Bug#608428: Bug#608428: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Sat, 1 Jan 2011 19:58:49 +0100 (CET)
> It's really rather odd that the userspace structures (assuming FreeBSD
> doesn't use the same header for the kernel too, which I'm not sure is
> right)

It does :-(

> have such inconsistent and restrictive lengths compared with
> what's technically permitted by the actual mount/umount system calls.

The vfs_donmount() from
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/vfs_mount.c

        /*
         * Be ultra-paranoid about making sure the type and fspath
         * variables will fit in our mp buffers, including the
         * terminating NUL.
         */
        if (fstypelen >= MFSNAMELEN - 1 || fspathlen >= MNAMELEN - 1) {
                error = ENAMETOOLONG;
                goto bail;
        }

The restriction comes from kernel.

Petr






Information forwarded to debian-bugs-dist@lists.debian.org, GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>:
Bug#608428; Package freebsd-utils. (Wed, 05 Jan 2011 20:06:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roger Leigh <rleigh@codelibre.net>:
Extra info received and forwarded to list. Copy sent to GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>. (Wed, 05 Jan 2011 20:06:06 GMT) Full text and rfc822 format available.

Message #52 received at 608428@bugs.debian.org (full text, mbox):

From: Roger Leigh <rleigh@codelibre.net>
To: Jakub Wilk <jwilk@debian.org>, 608428@bugs.debian.org
Cc: debian-bsd@lists.debian.org
Subject: Re: [buildd-tools-devel] Bug#608428: Bug#608428: Bug#608428: schroot: [kfreebsd-*] cannot handle long (>= 14 chars) chroot names
Date: Wed, 5 Jan 2011 20:03:00 +0000
[Message part 1 (text/plain, inline)]
clone 608428 -1
reassign -1 schroot
severity -1 serious
tags -1 patch
thanks

On Sat, Jan 01, 2011 at 02:42:08PM +0000, Roger Leigh wrote:
> reassign 608428 freebsd-utils
> severity 608428 serious
> thanks
> 
> On Thu, Dec 30, 2010 at 10:18:27PM +0000, Roger Leigh wrote:
> > On Thu, Dec 30, 2010 at 09:06:28PM +0100, Jakub Wilk wrote:
> > 
> > Hi Jakub,
> > 
> > > On kfreebsd-*, schroot is not able to unmount everything if chroot name  
> > > is longer than 13 characters:
> > >
> > > # schroot -c 123456789abcde echo Hello world
> > > Hello world
> > > E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcde-e7de3ef4-e02c-430c-b9d9-0e4eb34f3bd0/dev/f failed: Invalid argument
> > >
> > > If the name is longer than 18 characters, it cannot even run a command:
> > >
> > > # schroot -c 123456789abcdefghij echo Hello world
> > > E: 10mount: mount: dev : File name too long
> > > E: 10mount: umount: unmount of /var/lib/schroot/mount/123456789abcdefghij-cf720545-3204-4bda-93a8-82bbd3ac46ca/ failed: Invalid argument
> > >
> > > Given that e.g. sbuild-createchroot creates chroot named  
> > > "$SUITE-kfreebsd-$CPU-sbuild" (which is >= 23 characters), this is quite  
> > > an unfortunate limitation.
> > 
> > Yes, it is.  Given that schroot only runs the system's standard
> > "mount" and "umount" commands, is this an underlying limitation in
> > either those commands or in the system calls?  Or in the shell?
> 
> I've created a kfreebsd install using kvm, and installed sbuild and
> schroot in it, and I have reproduced the problem.
> 
> The bug is not in sbuild; it's reproducible with schroot alone as you
> saw.
> 
> The bug is not in schroot; it's reproducible with the plain
> mount/umount commands and long paths, shown below.

Please could you try the following patch against schroot:

diff --git a/debian/rules b/debian/rules
index 16d93b4..2cc89bd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,6 +19,12 @@ else
 	BTRFSSNAP_OPTIONS = --enable-btrfs-snapshot
 endif
 
+ifneq ($(DEB_HOST_ARCH_OS),kfreebsd)
+	UUID_OPTIONS = --enable-uuid
+else
+	UUID_OPTIONS = --disable-uuid
+endif
+
 CFLAGS = -Wall -g
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
@@ -44,7 +50,7 @@ debian/build/config.status: configure
 	  --enable-dchroot --enable-dchroot-dsa \
 	  --enable-static --disable-shared \
 	  --with-bash-completion-dir=/etc/bash_completion.d \
-	  $(LVMSNAP_OPTIONS) $(BTRFSSNAP_OPTIONS) \
+	  $(LVMSNAP_OPTIONS) $(BTRFSSNAP_OPTIONS) $(UUID_OPTIONS) \
 	  BTRFS=/sbin/btrfs \
 	  BTRFSCTL=/sbin/btrfsctl \
 	  LVCREATE=/sbin/lvcreate \

This disables the long UUIDs in the session names.  It uses a shortened
form of the chroot name + pid which is also typically unique.  Not
ideal, but should hopefully mitigate the issue by reducing the path
length (we can't fix the main issue, so this is a workaround for
kfreebsd in schroot).


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
[signature.asc (application/pgp-signature, inline)]

Bug 608428 cloned as bug 609052. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Wed, 05 Jan 2011 20:06:06 GMT) Full text and rfc822 format available.

Bug reassigned from package 'freebsd-utils' to 'schroot'. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Wed, 05 Jan 2011 20:06:09 GMT) Full text and rfc822 format available.

Severity set to 'serious' from 'important' Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Wed, 05 Jan 2011 20:06:09 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Wed, 05 Jan 2011 20:06:10 GMT) Full text and rfc822 format available.

Forcibly Merged 609052 609108. Request was from Jakub Wilk <jwilk@debian.org> to control@bugs.debian.org. (Thu, 06 Jan 2011 14:51:03 GMT) Full text and rfc822 format available.

Unset Bug forwarded-to-address Request was from Jakub Wilk <jwilk@debian.org> to control@bugs.debian.org. (Thu, 06 Jan 2011 14:51:05 GMT) Full text and rfc822 format available.

Added tag(s) pending and fixed-upstream. Request was from Roger Leigh <rleigh@codelibre.net> to control@bugs.debian.org. (Fri, 07 Jan 2011 15:12:05 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 09 Feb 2011 07:31:28 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 12:44:28 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.