9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-21 16:24 Russ Cox
  2002-03-22 10:17 ` Matthew C Weigel
  0 siblings, 1 reply; 16+ messages in thread
From: Russ Cox @ 2002-03-21 16:24 UTC (permalink / raw)
  To: 9fans

> Doing the right thing for directory mtimes, when the directory itself
> is not in the wrap, is a bit more difficult; ideally any directory
> containing files would have an mtime that was the maximum of mtimes of
> those contained files (this should already be so for directories which

This is true, because we set every mtime in the whole
archive to be the same -- the date of distribution.
But in general it's not true of any file system I know of.

> are themselves in the wrap), but setting the correct mtime on a
> directory not in the wrap, that has only directories, that gets

These should not exist.  If a path is included, so is an entry
for each directory along the way.  (I think.)

> affected by the wrap, is *really* difficult.  Looking at 9e.c, it
> appears that ctime - and hence directory creation time? - is not stored
> in a wrap, making the necessary information unavailable.

Yes, ctime is omitted.  Please don't tell me you can set ctime.

Russ


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-25 14:21 rob pike, esq.
  0 siblings, 0 replies; 16+ messages in thread
From: rob pike, esq. @ 2002-03-25 14:21 UTC (permalink / raw)
  To: 9fans

> If I remember correctly, the source for this misconception is K&R. 

The first printing of the second edition calls ctime 'the time originally created'.

-rob



^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-22 15:03 forsyth
  2002-03-22 15:10 ` Boyd Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: forsyth @ 2002-03-22 15:03 UTC (permalink / raw)
  To: 9fans

>> affected by the wrap, is *really* difficult.  Looking at 9e.c, it
>> appears that ctime - and hence directory creation time? - is not stored
>> in a wrap, making the necessary information unavailable.

>Yes, ctime is omitted.  Please don't tell me you can set ctime.

of course, Unix ctime isn't creation time either; that term was probably
encouraged by a comment in the old include file.
i think `inode change time' was a more accurate description: internally
the ICHG flag was updated in many places, causing ctime to change
on allocation of new blocks, modes, owner, ...
(i'm not sure why i bothered to point that out.)


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-22 14:34 Russ Cox
  2002-03-25  9:58 ` Matthew C Weigel
  0 siblings, 1 reply; 16+ messages in thread
From: Russ Cox @ 2002-03-22 14:34 UTC (permalink / raw)
  To: 9fans

> >There is a remove file included in the wrap
> >metadata directory containing a list of files
> >to be removed.  There are no remove directories though.
> 
> Hmmm. Unwrap seems to think that it is of length zero, which it assumes
> is a directory.  The source to the actual Plan 9 wrap programs is a bit
> more convoluted that 9e.c, so I haven't gotten to it yet.

Many of the remove files are of length zero, but that doesn't
mean they are directories.  An entry is a directory if and only if
$2 (which is octal) has the high bit set.  For example, in:

/wrap 20000000775 sys sys 1007472771 0
/sys/src/cmd/du.c 664 sys sys 1007472771 3297

wrap is a directory, du.c is not.

Wrap archives are in the same format as used by 
/sys/src/cmd/disk/mkext.c, which is a nice short reference.



^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-22 14:30 Russ Cox
  2002-03-25  9:58 ` Matthew C Weigel
  0 siblings, 1 reply; 16+ messages in thread
From: Russ Cox @ 2002-03-22 14:30 UTC (permalink / raw)
  To: 9fans

> That is not what it looks like to me: in the 6/17/00 archfs.9gz, wrap/
> has an mtime of 6/4/00, while everything else has an mtime of 6/17/00.

Ah.  Yes, the partial updates sometimes have varying mtimes inside them.
For the full releases we timestamp all the files with the date of the release.

> I've been doing my testing with the 6/17 archfs.9gz. It contains
> 386/bin/archfs and sys/src/cmd/archfs.c but not 386, 386/bin, sys, and
> so on.  At least according to the unwrap perl script (original).

Sorry, you're right.  I went back and forth on this in the wrap code,
and it looks like I didn't include the directory tree for partial updates.

We have no ctime, so I'm afraid there's not much that can be
done on that front.  

Russ





^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-21 16:22 Russ Cox
  2002-03-22 10:18 ` Matthew C Weigel
  0 siblings, 1 reply; 16+ messages in thread
From: Russ Cox @ 2002-03-21 16:22 UTC (permalink / raw)
  To: 9fans

> Also, does wrap support removing files?  I thought perhaps that was the
> purpose of the 'remove' directories I see in a few places... that seems
> like needed functionality in a version repository.

There is a remove file included in the wrap
metadata directory containing a list of files
to be removed.  There are no remove directories though.

The last entry isn't bogus.  You're probably misparsing it.
The archive ends with "end of archive\n".

Russ


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [9fans] Playing with unwrap on Unix
@ 2002-03-20 14:44 Russ Cox
  2002-03-21 11:01 ` Matthew C Weigel
  2002-03-21 11:02 ` Matthew C Weigel
  0 siblings, 2 replies; 16+ messages in thread
From: Russ Cox @ 2002-03-20 14:44 UTC (permalink / raw)
  To: 9fans

> It *will* still overwrite newer files, and it doesn't seem to set the
> mtime on directories correctly (from one simple test), but I think it
> still qualifies as an improvement.

That's okay; wrap doesn't set the mtime on directories
properly either.  The problem is that the directory gets
created before its children, and creating children changes
the mtime of the directory, so you'd have to set it on
the way out too.



^ permalink raw reply	[flat|nested] 16+ messages in thread
* [9fans] Playing with unwrap on Unix
@ 2002-03-20  9:43 Matthew C Weigel
  0 siblings, 0 replies; 16+ messages in thread
From: Matthew C Weigel @ 2002-03-20  9:43 UTC (permalink / raw)
  To: 9fans

I noticed yesterday that the Plan 9 LXR
(http://offworld.fac.cs.cmu.edu/plan9) is actually being used a little,
despite being out of date, so I decided to try to update it.

In poking at doing so, I ran across the problem that the unwrap Perl
script doesn't set the mtime on the files it writes to the mtime of the
file in the wrap - they're set to the time unwrap is run.  Since I am
coming to this long after Steve Wynne left, the timestamps the LXR
reports would no longer even closely correspond to the actual times the
files were last edited.

Now I've got a slightly better unwrap: it both prints out and sets the
mtime and atime of the file to the mtime for the file according to the
wrap.  I figured it out with a little help from the 9e source.

It *will* still overwrite newer files, and it doesn't seem to set the
mtime on directories correctly (from one simple test), but I think it
still qualifies as an improvement.

I've put it up at http://offworld.fac.cs.cmu.edu/unwrap in case it will
help someone else.
-- 
 Matthew Weigel
 Research Systems Programmer
 mcweigel+@cs.cmu.edu
Followup-To: 
Distribution: 
Organization: University of Bath Computing Services, UK
Keywords: 
Cc: 


-- 
Dennis Davis, BUCS, University of Bath, Bath, BA2 7AY, UK
D.H.Davis@bath.ac.uk


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2002-03-25 14:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-21 16:24 [9fans] Playing with unwrap on Unix Russ Cox
2002-03-22 10:17 ` Matthew C Weigel
  -- strict thread matches above, loose matches on Subject: below --
2002-03-25 14:21 rob pike, esq.
2002-03-22 15:03 forsyth
2002-03-22 15:10 ` Boyd Roberts
2002-03-25 11:12   ` Aharon Robbins
2002-03-22 14:34 Russ Cox
2002-03-25  9:58 ` Matthew C Weigel
2002-03-22 14:30 Russ Cox
2002-03-25  9:58 ` Matthew C Weigel
2002-03-21 16:22 Russ Cox
2002-03-22 10:18 ` Matthew C Weigel
2002-03-20 14:44 Russ Cox
2002-03-21 11:01 ` Matthew C Weigel
2002-03-21 11:02 ` Matthew C Weigel
2002-03-20  9:43 Matthew C Weigel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).