[Bug 1326110] [NEW] losetup silently fails to attach small files
Ryan Harper
1326110 at bugs.launchpad.net
Tue Jun 3 19:28:04 UTC 2014
Public bug reported:
1) # lsb_release -rd
Description: Ubuntu 12.04.4 LTS
Release: 12.04
2) # apt-cache policy util-linux
util-linux:
Installed: 2.20.1-1ubuntu3
Candidate: 2.20.1-1ubuntu3
Version table:
*** 2.20.1-1ubuntu3 0
500 http://archive.ubuntu.com//ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
3) losetup -f /srv/swift.img
attach the file to a free loop device
4) losetup -f /srv/swift.img returned 0, but did not attach the file to
a loop device.
Specifically, the target file was very small, 20 bytes. The following
sequence was run:
truncate --size 20 /srv/swift.img
stat /srv/swift.img
losetup -f /srv/swift.img
losetup -a
When the file is small (20 bytes) losetup returns zero, but does not
setup the file. Through some investigation, it appears any file of size
< 512 will fail in this way:
root at hayward-42:~# truncate --size 511 /srv/swift.img
root at hayward-42:~# stat /srv/swift.img
File: `/srv/swift.img'
Size: 511 Blocks: 0 IO Block: 4096 regular file
Device: 801h/2049d Inode: 5767170 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-06-03 19:24:58.213512482 +0000
Modify: 2014-06-03 19:26:52.593509603 +0000
Change: 2014-06-03 19:26:52.593509603 +0000
Birth: -
root at hayward-42:~# losetup --find /srv/swift.img
root at hayward-42:~# echo $?
0
root at hayward-42:~# losetup -a
Here is a successful sequence with size=512:
root at hayward-42:~# truncate --size 512 /srv/swift.img
root at hayward-42:~# stat /srv/swift.img
File: `/srv/swift.img'
Size: 512 Blocks: 0 IO Block: 4096 regular file
Device: 801h/2049d Inode: 5767170 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-06-03 19:24:58.213512482 +0000
Modify: 2014-06-03 19:27:33.029508499 +0000
Change: 2014-06-03 19:27:33.029508499 +0000
Birth: -
root at hayward-42:~# losetup --find /srv/swift.img
root at hayward-42:~# echo $?
0
root at hayward-42:~# losetup -a
/dev/loop7: [0801]:5767170 (/srv/swift.img)
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: mount 2.20.1-1ubuntu3
ProcVersionSignature: Ubuntu 3.2.0-60.91-generic 3.2.55
Uname: Linux 3.2.0-60-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Tue Jun 3 19:16:57 2014
MarkForUpload: True
ProcEnviron:
TERM=screen
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)
** Affects: util-linux (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug precise
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1326110
Title:
losetup silently fails to attach small files
Status in “util-linux” package in Ubuntu:
New
Bug description:
1) # lsb_release -rd
Description: Ubuntu 12.04.4 LTS
Release: 12.04
2) # apt-cache policy util-linux
util-linux:
Installed: 2.20.1-1ubuntu3
Candidate: 2.20.1-1ubuntu3
Version table:
*** 2.20.1-1ubuntu3 0
500 http://archive.ubuntu.com//ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
3) losetup -f /srv/swift.img
attach the file to a free loop device
4) losetup -f /srv/swift.img returned 0, but did not attach the file
to a loop device.
Specifically, the target file was very small, 20 bytes. The following
sequence was run:
truncate --size 20 /srv/swift.img
stat /srv/swift.img
losetup -f /srv/swift.img
losetup -a
When the file is small (20 bytes) losetup returns zero, but does not
setup the file. Through some investigation, it appears any file of
size < 512 will fail in this way:
root at hayward-42:~# truncate --size 511 /srv/swift.img
root at hayward-42:~# stat /srv/swift.img
File: `/srv/swift.img'
Size: 511 Blocks: 0 IO Block: 4096 regular file
Device: 801h/2049d Inode: 5767170 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-06-03 19:24:58.213512482 +0000
Modify: 2014-06-03 19:26:52.593509603 +0000
Change: 2014-06-03 19:26:52.593509603 +0000
Birth: -
root at hayward-42:~# losetup --find /srv/swift.img
root at hayward-42:~# echo $?
0
root at hayward-42:~# losetup -a
Here is a successful sequence with size=512:
root at hayward-42:~# truncate --size 512 /srv/swift.img
root at hayward-42:~# stat /srv/swift.img
File: `/srv/swift.img'
Size: 512 Blocks: 0 IO Block: 4096 regular file
Device: 801h/2049d Inode: 5767170 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-06-03 19:24:58.213512482 +0000
Modify: 2014-06-03 19:27:33.029508499 +0000
Change: 2014-06-03 19:27:33.029508499 +0000
Birth: -
root at hayward-42:~# losetup --find /srv/swift.img
root at hayward-42:~# echo $?
0
root at hayward-42:~# losetup -a
/dev/loop7: [0801]:5767170 (/srv/swift.img)
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: mount 2.20.1-1ubuntu3
ProcVersionSignature: Ubuntu 3.2.0-60.91-generic 3.2.55
Uname: Linux 3.2.0-60-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Tue Jun 3 19:16:57 2014
MarkForUpload: True
ProcEnviron:
TERM=screen
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1326110/+subscriptions
More information about the foundations-bugs
mailing list