Re: "git clone" executed as root on solaris 10 shreds UFS (it ispossible to create hardlinks for directories as root under solaris)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Glanzmann wrote:
>         static void create_directories(const char *path, const struct checkout *state)
>         {
>         ...
>                         if (mkdir(buf, 0777)) {
> =>                              if (errno == EEXIST) {
>                                         struct stat st;
> =>                                      if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))
>                                                 continue;
>                                         if (!stat(buf, &st) && S_ISDIR(st.st_mode))
>                                                 continue; /* ok */
>                                 }
>                                 die("cannot create directory at %s", buf);
>                         }
>         ...
> 
> I think here is the problem. I don't understand what the code should do
> actually. Or why the directory is deleted and re-created (maybe something todo
> with permissions)?

It tries to remove a *file* that is in the way and create the directory
in its place. But since your unlink() behaves incorrectly (it is
supposed to *fail* for directories), the logic does not quite work as
expected - it mistakes the directory for a file.

Try swapping the two inner-most if-blocks.

-- Hannes

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux