Changes to files with file descriptors open not detected
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu One Client |
Confirmed
|
Medium
|
Ubuntu One Foundations+ team | ||
ubuntuone-client (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: ubuntuone-client
Ubuntu One Sync Daemon won't rescan a changed file if the file has processes still opening it for write. This causes problems when some session-wide opened files are put in sync, where the only chance of a file close event is the user logging out, when ubuntuone-
Steps to reproduce:
1. Add a user defined directory ~/foo
2. create a file hello.txt with content "hello\n"
3. change the content of the file into "heLLO" in a process, flush out the change but keep the file open [2]
Expected behavior:
Ubuntu One Sync Daemon detects the change and updates the local hash and stat info accordingly. (How it schedules the upload of change is another story)
Actual behavior:
Ubuntu One won't detect the change until the file is closed.
auxiliary scripts to automate reproduction of this bug:
[1] tu.sh, referencing u.py [2]
#!/bin/bash
cd ~/foo
echo "hello" > hello.txt; sha1sum hello.txt; echo $((0x`crc32 hello.txt`)); u1sdtool -s;
sleep 1; u1sdtool --info ~/foo/hello.txt | egrep --color 'crc|hash|stat'
echo
cp hello.txt /tmp/hello.txt
python /tmp/u.py &
echo $((0x`crc32 hello.txt`)); sha1sum hello.txt; u1sdtool -s;
fuser hello.txt
sleep 3; u1sdtool -s; u1sdtool --info ~/foo/hello.txt | egrep --color 'crc|hash|stat'
wait %1
[2] u.py
#!/usr/bin/python
import time
with open("/
f.write(
f.flush()
time.sleep(5)
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: ubuntuone-client 1.2.2-0ubuntu2
ProcVersionSign
Uname: Linux 2.6.32-24-generic x86_64
Architecture: amd64
Date: Mon Sep 27 22:06:02 2010
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Beta amd64 (20100318)
PackageArchitec
ProcEnviron:
PATH=(custom, user)
LANG=en_US.utf8
SHELL=/bin/bash
SourcePackage: ubuntuone-client
UbuntuOneClient
[ubuntuone]
bookmarked = True
connected = True
connect = 0
show_applet = 1
UbuntuOneUserSy
[bandwidth_
read_limit = 2097152
write_limit = 2097152
on = False
Changed in ubuntuone-client (Ubuntu): | |
status: | New → Confirmed |
Changed in ubuntuone-client: | |
assignee: | nobody → Ubuntu One Foundations+ team (ubuntuone-foundations+) |
importance: | Undecided → Medium |
status: | New → Confirmed |
My guess is that somewhere in the daemon it has only added the IN_CLOSE_WRITE event for inotify. I haven't gone through the source code, but a simple script that opens and closes the file kind of validates my hypothesis: after running the script, u1 picks up the change and uploads as expected.