Bug 660687

Summary: guestmount: "touch" command fails: touch: setting times of `timestamp': Invalid argument
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: mbooth, virt-maint
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-16 16:26:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Jenkins console output. none

Description Richard W.M. Jones 2010-12-07 15:40:50 UTC
Description of problem:

Mount an empty filesystem on /tmp/mnt using guestmount, and
run the following script, which is adapted from the test-fuse.sh
script in the fuse/ directory of the sources.

-------------------------------
#!/bin/bash -

set -e
set -v

cd /tmp/mnt

while true; do
  for ts in 12345 1234567 987654321; do
    touch -a -d @$ts timestamp
    [ "$(stat -c %X timestamp)" -eq $ts ]
    touch -m -d @$ts timestamp
    [ "$(stat -c %Y timestamp)" -eq $ts ]
    touch    -d @$ts timestamp
    [ "$(stat -c %X timestamp)" -eq $ts ]
    [ "$(stat -c %Y timestamp)" -eq $ts ]
  done
done
-------------------------------

The script may fail with:

touch: setting times of `timestamp': Invalid argument

Version-Release number of selected component (if applicable):

libguestfs 1.7.19
fuse 2.8.4-1.1 (Debian)

How reproducible:

The failure is unpredictable.  On Fedora it doesn't seem to
fail at all, whereas on Debian it fails very frequently.

Comment 1 Richard W.M. Jones 2010-12-07 15:42:19 UTC
Seems to be a FUSE issue, because at the point where the
error occurs we aren't inside any guestmount code.

Also small changes to the script make the error go away,
eg. adding a sleep before the 'touch' commands.

Comment 2 Richard W.M. Jones 2010-12-19 11:13:57 UTC
It appears to fail the first time after the filesystem
has been mounted, but not thereafter.

$ ./fuse/guestmount -a test1.img -m /dev/sda1 /tmp/mnt
$ /tmp/test.sh
[fails immediately with ...]
touch: setting times of `timestamp': Invalid argument
$ /tmp/test.sh
[runs fine, however long I run it or however many times
I kill and restart it]

Then unmount and remount:

$ fusermount -u /tmp/mnt
$ ./fuse/guestmount -a test1.img -m /dev/sda1 /tmp/mnt 
$ /tmp/test.sh
[fails immediately with ...]
touch: setting times of `timestamp': Invalid argument

Comment 3 Richard W.M. Jones 2010-12-19 12:41:21 UTC
I think this is a FUSE problem, or at least I can't work
out what's going on.  Asked on fuse-devel:
http://sourceforge.net/mailarchive/message.php?msg_id=26780130

Comment 4 Pino Toscano 2013-12-12 15:54:40 UTC
Fixed by
https://github.com/libguestfs/libguestfs/commit/1877c106030361821cf36c8873455d0c3d7134d3
which is in libguestfs >= 1.25.14.

Comment 5 Richard W.M. Jones 2014-01-07 13:47:36 UTC
Created attachment 846673 [details]
Jenkins console output.

This error occurs in Jenkins testing (with libguestfs.git)
so it looks like it is not actually fixed.

Comment 6 Pino Toscano 2014-01-16 16:26:14 UTC
Hopefully fixed for good (I would hope, now) with
https://github.com/libguestfs/libguestfs/commit/99d6e2c84ef490feb6ff2e37e4b0684f34bac554
which is in libguestfs >= 1.25.22.