alibuild icon indicating copy to clipboard operation
alibuild copied to clipboard

Make "sw" folder read-only

Open Barthelemy opened this issue 8 years ago • 8 comments

I discovered that the folder "sw" should not be deleted because everything is screwed if you do so. I propose to make it read only to help prevent users from deleting it by mistake or out of rage ;)

Barthelemy avatar Mar 01 '17 14:03 Barthelemy

If I understood @ktf and @dberzano correctly, deleting sw/ is the intended reset process. You can then just rebuild your software, and the folder, using a single aliBuild command.

Azralee avatar Jul 27 '17 06:07 Azralee

So, deleting sw is indeed the intended reset process. However, there are bare Git clones under sw/MIRROR used as base for development clones created with aliBuild init.

That is: your clone created with aliBuild init will stop working as a Git clone if you delete sw. But your Git working directory will stay intact, and there is an easy way, or two, to recover it.

Say you've deleted sw. You go under your development directory, run a git status, and you will find a message like:

error: object directory /private/tmp/testme/sw/MIRROR/zlib/objects does not exist; check .git/objects/info/alternates.
fatal: bad object HEAD

but if you do ls you will find the last checked out working directory there.

Solution 1: make it an ordinary Git clone

You can simply make it independent from the nonexisting sw directory by deleting the alternates file:

rm .git/objects/info/alternates

Solution 2: attach it to another bare clone

You can recreate your sw/MIRRORS elsewhere, maybe by using aliBuild init again, and change the content of .git/objects/info/alternates to point it to the new bare directory.

In either case, nothing is screwed up and there is no need to make the sw directory read-only.

I suggest we add a Troubleshooting section with this info and close this ticket.

dberzano avatar Jul 27 '17 07:07 dberzano

I agree for adding a troubleshooting section.

What would really help though, and I think there is already a ticket for that, would be the possibility to do "aliBuild reset X" and it would force the rebuild of a specific package.

Barthelemy avatar Jul 27 '17 07:07 Barthelemy

I agree that there are some corner cases where this is - unfortunately - needed.

dberzano avatar Jul 27 '17 07:07 dberzano

Unless I'm mistaken (and it happened already in the past ;-) ) this very important information has not yet made it to the documentation ? (nor a reset option been introduced in alibuild) ?

Yes, I've tried to remove my sw directory today ...

aphecetche avatar Sep 29 '17 09:09 aphecetche

Laurent, I am pleased not to be alone doing this type of mistakes ;)

Barthelemy avatar Oct 02 '17 06:10 Barthelemy

Action item about documentation added at #486.

ktf avatar Oct 03 '17 08:10 ktf

Hi,

Coming back to the issue... I was hit again today because I have one source that I'd like to share for two different builds : one local on my mac and one in a docker (centos7) container which has its own sw directory (as a docker volume, because bind mounting is simply too slow for writing).

So I tried option 1 :

rm .git/objects/info/alternates

and that did not go really well... because after that I got :

~/alice/o2-dev/AliRoot   master* ⇣
❯ mv .git/objects/info/alternates  .git/objects/info/alternates.backup
~/alice/o2-dev/AliRoot   master
❯ git status
fatal: unable to read tree f82aa9ab67040bf8b3b83b0eb7f01c08a621300b

Is that really the only thing to do to convert a repo to a "regular" one ?


aphecetche avatar Oct 10 '17 08:10 aphecetche