Re: Directories must not be symbolic

Adam Spiers <[email protected]> Sun, 28 Feb 2016 13:31:52 +0000
Newsgroups gmane.comp.gnu.stow.bugs
Message-ID <[email protected]>
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-in=
sert
>         =E2=94=82   =E2=94=82       =E2=94=9C=E2=94=80=E2=94=80 post-ne=
w
>         =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

> The problem is that if a directory doesn't exist in the target director=
y
> (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 | xarg=
s 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.

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

HTH,
Adam