Re: [fossil-users] Fossil commands will not follow through managed symlink dirs

2012-05-17 Thread Matt Welland
On Thu, May 17, 2012 at 5:02 PM, Gé Weijers  wrote:

> Oops I sent this out before it was ready.
>
> Basically, you keep a list of device-inode pairs for each file while
> traversing the file system, which lets you detect duplicates.
>
> Ge'
>

Can realpath or equivalent be used in fossil? If so it would be simpler. I
think this scenario is not really the same as hard links.

>From "man 3 realpath"

 #include 
 #include 

 char *realpath(const char *path, char *resolved_path);

DESCRIPTION
   realpath() expands all symbolic links and resolves references to
/./, /../ and extra '/' characters in the
   null-terminated string named by path to produce a canonicalized
absolute pathname.  The resulting
   pathname is stored as a null-terminated string, up to a maximum of
PATH_MAX bytes, in the buffer
   pointed to by resolved_path.  The resulting path will have no
symbolic link, /./ or /../ components.




>
>
>
>
>
> --
> Gé
>
>
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
>
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Fossil commands will not follow through managed symlink dirs

2012-05-17 Thread Gé Weijers
Oops I sent this out before it was ready.

Basically, you keep a list of device-inode pairs for each file while
traversing the file system, which lets you detect duplicates.

Ge'




-- 
Gé
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Fossil commands will not follow through managed symlink dirs

2012-05-17 Thread Gé Weijers
To prevent stupid stuff from happening fossil could (on (Lin|Un|Pos)ix at
least) track whether any file it manages shows up twice by looking at the
output of the stat() system call:

  if (S_ISREG(statdata.st_mode) &&  statdata.st_nlink > 1) {
 if (seen_before(statdata.st_dev, statdata.st_ino))

- if the link count is > 1 remember the device & inode number
- look for duplicate device-inode pairs, and throw a fit if a combination
shows up more than once.

Backup programs do this to handle hard links.



On Tue, May 15, 2012 at 5:20 PM, Ron Wilson  wrote:

> On 5/15/12, James Masters  wrote:
> > Sorry, I missed the crucial step of adding and comitting dir_b as a
> > symlink.  Please append this to my example above:
> >
> > % fsl add dir_b
> > ADDED  dir_b
> > % fsl commit dir_b -m 'adding symlink'
> > ADDED  dir_b
> > ...
> > % fsl ann dir_b/foo
> > fossil: no such file: dir_b/foo
> > The confusion is that dir_b is a symlink to dir_a and when I follow that
> > symlink for normal file operations, it operates upon the file as if it
> were
> > a normal dir/file at the OS level.  But not with fossil.
>
> To most applications, dir_a/foo and dir_b/foo are 2 seperate files. In
> Unix derived OSes, symbolic links are designed to be transparant to
> applications that are ignorant of sym links.
>
> You might argue that Fossil has a need to be aware of sym links, else
> you end up with 2 (or more) of the same file under different names
> (where name == the full path), but there are more complications. Even
> if sym links worked exactly the same in all OSes, how to treat any
> given sym link is an open question subject to a lot of debate.
>
> For me, sym links would be a way to reference the working copy of a
> shared subproject in a project's working copy. While SVN's way of
> handling external references works, in my experience, it is too easy
> to end up with multiple working copies of the same shared project, so
> even with that usage model, there are complications.
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>



-- 
Gé
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users