Re: Directories must not be symbolic

Vivien Didelot <[email protected]> Sun, 28 Feb 2016 19:36:09 -0500
Newsgroups gmane.comp.gnu.stow.bugs
Message-ID <[email protected]>
Hi Adam,

Adam Spiers <[email protected]> writes:

> Hi Viven,
>
> On Fri, Dec 04, 2015 at 08:48:15PM -0500, Vivien Didelot wrote:
>> Hi,
>>=20
>> I'm using Stow to manage my dotfiles as packages. I basically have the
>> following Stow directory in my $HOME:
>>=20
>>     Stow
>>     =E2=94=9C=E2=94=80=E2=94=80 emacs
>>     =E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 .emacs
>>     =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .emacs.d
>>     =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 .placeholder
>>     =E2=94=9C=E2=94=80=E2=94=80 git
>>     =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .gitconfig
>>     =E2=94=94=E2=94=80=E2=94=80 mail
>>         =E2=94=9C=E2=94=80=E2=94=80 bin
>>         =E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 mua
>>         =E2=94=9C=E2=94=80=E2=94=80 .emacs.d
>>         =E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 notmuch-config.el
>>         =E2=94=9C=E2=94=80=E2=94=80 Mail
>>         =E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 .notmuch
>>         =E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 hooks
>>         =E2=94=82   =E2=94=82       =E2=94=9C=E2=94=80=E2=94=80 post-ins=
ert
>>         =E2=94=82   =E2=94=82       =E2=94=9C=E2=94=80=E2=94=80 post-new
>>         =E2=94=82   =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 pre-new
>>         =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 work
>>         =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 .placeholder
>>         =E2=94=9C=E2=94=80=E2=94=80 .mbsyncrc
>>         =E2=94=9C=E2=94=80=E2=94=80 .msmtprc
>>         =E2=94=94=E2=94=80=E2=94=80 .notmuch-config
>
> Cool!  I do something almost identical, except I call the stow
> directory ~/.STOW.  As an aside, did you see this which I linked from
> the homepage?
>
>   http://lists.gnu.org/archive/html/info-stow/2011-12/msg00000.html

I think I've seen that page before, yes.

>> The problem is that if a directory doesn't exist in the target directory
>> (here it is $HOME), Stow will create a symlink for it, instead of
>> creating a real directory.
>>=20
>> This is bad and unlikely to be wanted, because you may end up flooding
>> your Stow packages with unwanted files.
>>=20
>> For instance, emacs will add some files in ~/.emacs.d
>> (e.g. auto-save-list, elpa, ido.last), that I wish not to manage. Worst,
>> my email database synced in ~/Mail/work (about 2.3G) or the notmuch
>> database in ~/Mail/.notmuch (about 1.8G) got into my mail package.
>>=20
>> To workaround this issue, I remember myself to type the following
>> command from within the Stow directory to ensure each (or a single)
>> package has the required directories in the target before stowing it:
>>=20
>>     find * -mindepth 1 -type d | sed "s,^[^/]*,$HOME," | sort -u | xargs=
 mkdir -p
>>=20
>> IMHO, Stow must only symlink files, and create real directories. This
>> would ensure a simple and determinist behavior, and remove the need for
>> placeholders. What do you think?
>
> That's precisely why I added the --no-folding option:
>
>   https://www.gnu.org/software/stow/manual/html_node/Installing-Packages.=
html#tree%20folding
>   https://github.com/aspiers/stow/commit/ed12c787df985896c8ba1c188af45b9f=
b637b017
>
> ;-)  So your find pipeline is unnecessary.

Great! I tested it and indeed it removes the need for the placeholders.

> However personally I don't use --no-folding, because I want more
> fine-grained control over which directories are folded, and which
> aren't.  For that I use an ugly hack, which is a separate repo I call
> "ANTIFOLD", which contains empty hidden .no-stow-folding files in
> directories where I don't want folding.  I stow that repo to $HOME
> alongside the other ones, and the fact that there are two repos
> stowing to the same path causes Stow to ensure that that directory is
> unfolded (i.e. a real directory).
>
> And yes, it's on the TODO list to improve this:
>
>   https://github.com/aspiers/stow/blob/master/TODO

Do people use symlinks to directory a lot? Because of the flooding issue
I mentioned, I'd imagine --no-folding to be the default behavior, and
having a --folding or more explicit --symlink-dir option to change it.

Would that be acceptable?

Thanks for your time,

  -v