Welcome to MacForumz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

puzzling bug in iDisk file syncing

 
   Macintosh computer (Home) -> General Discussion RSS
Related Topics:
file location on Mac OSX - i would like to locate the files that store my email msgs from the Mail app. i have a form online that, when submited from my site, emails the content to me. i would like to write a C++ program that would parse the info DIRECTLY from my..

log to file from kext - I have been trying to get my kext to log to an arbitrary logfile, and have been an unending stream of kernel panics with no success. I started using directly on the rootvnode with no luck, and have since been trying namei()..

Creating a file of a particular type on Mac OSX - Hi, I am trying to create a file of a type and since I am not a regular Macintosh I have run into problems. Firstly I don't know the right way to create a file(I am using CARBON). Are there any samples anywhere on the web?

Read image file - Hello I want to use vImage library for image This library does not contain any function to read and write image from and to the disk. How can I do that? Thanks, Geppy

How access attributes of a file??? - How we will get the copyright and kind of a file I used this mdataitem , And mdataitem , But it dont work in mac10.3.9 My is needed work atleast in mac10.3.9 Please..
Next:  Xcode could not locate source file: {standard inp..  
Author Message
Tim Smith

External


Since: Nov 02, 2003
Posts: 95



(Msg. 1) Posted: Tue Feb 19, 2008 2:00 am
Post subject: puzzling bug in iDisk file syncing
Archived from groups: comp>sys>mac>programmer>misc (more info?)

This isn't really a programmer issue, other than knowing about this bug
might let you design your apps to work around it, but I'm puzzled as to
HOW this bug works, and this seems the most likely group to figure it
out.

Consider this shell script:

#!/bin/bash
VOL=/Volumes/iDisk/Documents
NAME="foo"
mkdir $VOL/tmp
date > $VOL/tmp/data.txt
mv $VOL/$NAME $VOL/tmp.old
mv $VOL/tmp $VOL/$NAME
#touch $VOL/$NAME/data.txt
rm -rf $VOL/tmp.old
cat $VOL/$NAME/data.txt

Run it with your local copy of your iDisk mounted on /Volumes/iDisk, and
it makes a directory named foo, containing a file, data.txt, that just
contains a timestamp.

(Note that this is using the classic procedure for overwriting a file on
a filesystem that doesn't support transactions--a procedure that is
probably pretty common).

Sync the iDisk, and foo and data.txt go up, as expected. Run the script
again, and sync again, and it catches that, as you'd expect.

Now edit the shell script, and change NAME to "foo.app" or "foo.oo3" (or
probably any other extension that is treated as a package by Finder
rather than as a directory).

After the first run, which creates foo.app, it syncs fine. Run it
again, and it does NOT pick up that foo.app needs to sync. Run it again
and sync. Nadda. Repeat until bored.

However, if you uncomment the touch line, then syncing works. That's
what puzzles me. Checking the times of foo.app and data.txt with stat,
most of the time they are all the same. The filesystem only seems to
keep access/create/modify times to the second, and most of the time, the
touch will occur in the same second the file was created, and so not
change any timestamp. (I know that the timespec struct used has seconds
and nanoseconds in it, but the naneseconds always appear to be zero).

I don't see any other metadata or other information about the file or
directory changed by the touch, either. As far as I can tell, a touch
of a file that occurs in the same second the file is created is a no op.

So how come the touch makes a difference? What is it changing that I'm
missing (and the iDisk Sync looks at).

PS: I've reported this bug to Apple, along with the details on
reproducing it. I've also reported it to the Omni Group, since
OmniOutliner documents are directories with an XML file in them, and run
smack dab into this bug.

--
--Tim Smith

 >> Stay informed about: puzzling bug in iDisk file syncing 
Back to top
Login to vote
Reinder Verlinde

External


Since: Feb 18, 2004
Posts: 173



(Msg. 2) Posted: Tue Feb 19, 2008 6:57 pm
Post subject: Re: puzzling bug in iDisk file syncing [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <reply_in_group-CFC0C3.02005819022008 DeleteThis @news.supernews.com>,
Tim Smith <reply_in_group DeleteThis @mouse-potato.com> wrote:

> This isn't really a programmer issue, other than knowing about this bug
> might let you design your apps to work around it, but I'm puzzled as to
> HOW this bug works, and this seems the most likely group to figure it
> out.
>
> Consider this shell script:
>
> #!/bin/bash
> VOL=/Volumes/iDisk/Documents
> NAME="foo"
> mkdir $VOL/tmp
> date > $VOL/tmp/data.txt
> mv $VOL/$NAME $VOL/tmp.old
> mv $VOL/tmp $VOL/$NAME
> #touch $VOL/$NAME/data.txt
> rm -rf $VOL/tmp.old
> cat $VOL/$NAME/data.txt
>
> Run it with your local copy of your iDisk mounted on /Volumes/iDisk, and
> it makes a directory named foo, containing a file, data.txt, that just
> contains a timestamp.
>
> (Note that this is using the classic procedure for overwriting a file on
> a filesystem that doesn't support transactions--a procedure that is
> probably pretty common).
>
> Sync the iDisk, and foo and data.txt go up, as expected. Run the script
> again, and sync again, and it catches that, as you'd expect.
>
> Now edit the shell script, and change NAME to "foo.app" or "foo.oo3" (or
> probably any other extension that is treated as a package by Finder
> rather than as a directory).
>
> After the first run, which creates foo.app, it syncs fine. Run it
> again, and it does NOT pick up that foo.app needs to sync. Run it again
> and sync. Nadda. Repeat until bored.
>
> However, if you uncomment the touch line, then syncing works. That's
> what puzzles me. Checking the times of foo.app and data.txt with stat,
> most of the time they are all the same. The filesystem only seems to
> keep access/create/modify times to the second, and most of the time, the
> touch will occur in the same second the file was created, and so not
> change any timestamp. (I know that the timespec struct used has seconds
> and nanoseconds in it, but the naneseconds always appear to be zero).
>
> I don't see any other metadata or other information about the file or
> directory changed by the touch, either. As far as I can tell, a touch
> of a file that occurs in the same second the file is created is a no op.

Even if it is to the filesystem, it need not be to code observing the
file system. In particular, I guess that FSEvents marks the directory as
needing changes.

Warning: that is just a guess. I did not even verify your claims, let
alone test that guess.

Reinder

 >> Stay informed about: puzzling bug in iDisk file syncing 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]