MAN page from Fedora 28 stow-2.2.2-5.fc28.noarch.rpm


Section: User Contributed Perl Documentation (1)
Updated: 2015-11-09


stow - software package installation manager 


stow [ options ] package ... 


This manual page describes GNU Stow 2.2.2, a program for managingthe installation of software packages. This is not the definitivedocumentation for stow; for that, see the info manual.

Stow is a tool for managing the installation of multiple softwarepackages in the same run-time directory tree. One historicaldifficulty of this task has been the need to administer, upgrade,install, and remove files in independent packages without confusingthem with other files sharing the same filesystem space. For instance,it is common to install Perl and Emacs in /usr/local. When onedoes so, one winds up (as of Perl 4.036 and Emacs 19.22) with thefollowing files in /usr/local/man/man1: a2p.1; ctags.1;emacs.1; etags.1; h2ph.1; perl.1; and s2p.1. Nowsuppose it's time to uninstall Perl. Which man pages get removed?Obviously perl.1 is one of them, but it should not be theadministrator's responsibility to memorize the ownership of individualfiles by separate packages.

The approach used by Stow is to install each package into its owntree, then use symbolic links to make it appear as though the filesare installed in the common tree. Administration can be performed inthe package's private tree in isolation from clutter from otherpackages. Stow can then be used to update the symbolic links. Thestructure of each private tree should reflect the desired structure inthe common tree; i.e. (in the typical case) there should be a bindirectory containing executables, a man/man1 directory containingsection 1 man pages, and so on.

Stow was inspired by Carnegie Mellon's Depot program, but issubstantially simpler and safer. Whereas Depot required database filesto keep things in sync, Stow stores no extra state between runs, sothere's no danger (as there was in Depot) of mangling directories whenfile hierarchies don't match the database. Also unlike Depot, Stowwill never delete any files, directories, or links that appear in aStow directory (e.g., /usr/local/stow/emacs), so it's alwayspossible to rebuild the target tree (e.g., /usr/local). 


A ``package'' is a related collection of files and directories thatyou wish to administer as a unit --- e.g., Perl or Emacs --- and thatneeds to be installed in a particular directory structure --- e.g.,with bin, lib, and man subdirectories.

A ``target directory'' is the root of a tree in which one or morepackages wish to appear to be installed. A common, but by no meansthe only such location is /usr/local. The examples in this manualpage will use /usr/local as the target directory.

A ``stow directory'' is the root of a tree containing separatepackages in private subtrees. When Stow runs, it uses the currentdirectory as the default stow directory. The examples in this manualpage will use /usr/local/stow as the stow directory, so thatindividual packages will be, for example, /usr/local/stow/perl and/usr/local/stow/emacs.

An ``installation image'' is the layout of files and directoriesrequired by a package, relative to the target directory. Thus, theinstallation image for Perl includes: a bin directory containingperl and a2p (among others); an info directory containingTexinfo documentation; a lib/perl directory containing Perllibraries; and a man/man1 directory containing man pages.

A ``package directory'' is the root of a tree containing theinstallation image for a particular package. Each package directorymust reside in a stow directory --- e.g., the package directory/usr/local/stow/perl must reside in the stow directory/usr/local/stow. The ``name'' of a package is the name of itsdirectory within the stow directory --- e.g., perl.

Thus, the Perl executable might reside in/usr/local/stow/perl/bin/perl, where /usr/local is the targetdirectory, /usr/local/stow is the stow directory,/usr/local/stow/perl is the package directory, and bin/perlwithin is part of the installation image.

A ``symlink'' is a symbolic link. A symlink can be ``relative'' or``absolute''. An absolute symlink names a full path; that is, onestarting from /. A relative symlink names a relative path; thatis, one not starting from /. The target of a relative symlink iscomputed starting from the symlink's own directory. Stow only createsrelative symlinks. 


The stow directory is assumed to be the value of the "STOW_DIR"environment variable or if unset the current directory, and the targetdirectory is assumed to be the parent of the current directory (so itis typical to execute stow from the directory /usr/local/stow).Each package given on the command line is the name of a package inthe stow directory (e.g., perl). By default, they are installedinto the target directory (but they can be deleted instead using"-D").
Do not perform any operations that modify the filesystem; merely showwhat would happen.
-d DIR
Set the stow directory to "DIR" instead of the current directory.This also has the effect of making the default target directory be theparent of "DIR".
-t DIR
Set the target directory to "DIR" instead of the parent of the stowdirectory.
Send verbose output to standard error describing what Stow isdoing. Verbosity levels are 0, 1, 2, 3, and 4; 0 is the default.Using "-v" or "--verbose" increases the verbosity by one; using`--verbose=N' sets it to N.
Stow the packages that follow this option into the target directory.This is the default action and so can be omitted if you are onlystowing packages rather than performing a mixture ofstow/delete/restow actions.
Unstow the packages that follow this option from the target directory ratherthan installing them.
Restow packages (first unstow, then stow again). This is usefulfor pruning obsolete symlinks from the target tree after updatingthe software in a package.
Warning! This behaviour is specifically intended to alter thecontents of your stow directory. If you do not want that, this optionis not for you.

When stowing, if a target is encountered which already exists but is aplain file (and hence not owned by any existing stow package), thennormally Stow will register this as a conflict and refuse to proceed.This option changes that behaviour so that the file is moved to thesame relative place within the package's installation image within thestow directory, and then stowing proceeds as before. So effectively,the file becomes adopted by the stow package, without its contentschanging.

Disable folding of newly stowed directories when stowing, andrefolding of newly foldable directories when unstowing.
Ignore files ending in this Perl regex.
Don't stow files beginning with this Perl regex if the file is alreadystowed to another package.
Force stowing files beginning with this Perl regex if the file isalready stowed to another package.
Show Stow version number, and exit.
Show Stow command syntax, and exit.


The default action of Stow is to install a package. This meanscreating symlinks in the target tree that point into the package tree.Stow attempts to do this with as few symlinks as possible; in otherwords, if Stow can create a single symlink that points to an entiresubtree within the package tree, it will choose to do that rather thancreate a directory in the target tree and populate it with symlinks.

For example, suppose that no packages have yet been installed in/usr/local; it's completely empty (except for the stowsubdirectory, of course). Now suppose the Perl package is installed.Recall that it includes the following directories in its installationimage: bin; info; lib/perl; man/man1. Rather thancreating the directory /usr/local/bin and populating it withsymlinks to ../stow/perl/bin/perl and ../stow/perl/bin/a2p (andso on), Stow will create a single symlink, /usr/local/bin, whichpoints to stow/perl/bin. In this way, it still works to refer to/usr/local/bin/perl and /usr/local/bin/a2p, and fewer symlinkshave been created. This is called ``tree folding'', since an entiresubtree is ``folded'' into a single symlink.

To complete this example, Stow will also create the symlink/usr/local/info pointing to stow/perl/info; the symlink/usr/local/lib pointing to stow/perl/lib; and the symlink/usr/local/man pointing to stow/perl/man.

Now suppose that instead of installing the Perl package into an emptytarget tree, the target tree is not empty to begin with. Instead, itcontains several files and directories installed under a differentsystem-administration philosophy. In particular, /usr/local/binalready exists and is a directory, as are /usr/local/lib and/usr/local/man/man1. In this case, Stow will descend into/usr/local/bin and create symlinks to ../stow/perl/bin/perl and../stow/perl/bin/a2p (etc.), and it will descend into/usr/local/lib and create the tree-folding symlink perl pointingto ../stow/perl/lib/perl, and so on. As a rule, Stow only descendsas far as necessary into the target tree when it can create atree-folding symlink.

The time often comes when a tree-folding symlink has to be undonebecause another package uses one or more of the folded subdirectoriesin its installation image. This operation is called ``splitting open''a folded tree. It involves removing the original symlink from thetarget tree, creating a true directory in its place, and thenpopulating the new directory with symlinks to the newly-installedpackage and to the old package that used the old symlink. Forexample, suppose that after installing Perl into an empty/usr/local, we wish to install Emacs. Emacs's installation imageincludes a bin directory containing the emacs and etagsexecutables, among others. Stow must make these files appear to beinstalled in /usr/local/bin, but presently /usr/local/bin is asymlink to stow/perl/bin. Stow therefore takes the followingsteps: the symlink /usr/local/bin is deleted; the directory/usr/local/bin is created; links are made from /usr/local/bin to../stow/emacs/bin/emacs and ../stow/emacs/bin/etags; and linksare made from /usr/local/bin to ../stow/perl/bin/perl and../stow/perl/bin/a2p.

When splitting open a folded tree, Stow makes sure that the symlinkit is about to remove points inside a valid package in the current stowdirectory. 

Stow will never delete anything that it doesn't own.

Stow ``owns'' everything living in the target tree that points into apackage in the stow directory. Anything Stow owns, it can recompute iflost. Note that by this definition, Stow doesn't ``own'' anythingin the stow directory or in any of the packages.

If Stow needs to create a directory or a symlink in the target treeand it cannot because that name is already in use and is not owned byStow, then a conflict has arisen. See the ``Conflicts'' section in theinfo manual. 


When the "-D" option is given, the action of Stow is to delete apackage from the target tree. Note that Stow will not delete anythingit doesn't ``own''. Deleting a package does not mean removing it fromthe stow directory or discarding the package tree.

To delete a package, Stow recursively scans the target tree, skippingover the stow directory (since that is usually a subdirectory of thetarget tree) and any other stow directories it encounters (see``Multiple stow directories'' in the info manual). Any symlink itfinds that points into the package being deleted is removed. Anydirectory that contained only symlinks to the package being deleted isremoved. Any directory that, after removing symlinks and emptysubdirectories, contains only symlinks to a single other package, isconsidered to be a previously ``folded'' tree that was ``split open.''Stow will re-fold the tree by removing the symlinks to the survivingpackage, removing the directory, then linking the directory back tothe surviving package. 


The full documentation for stow is maintained as a Texinfo manual.If the info and stow programs are properly installed at your site, the command

    info stow

should give you access to the complete manual. 


Please report bugs in Stow using the Debian bug tracking system.

Currently known bugs include:

The empty-directory problem.

If package foo includes an empty directory --- say, foo/bar ---then if no other package has a bar subdirectory, everything's fine.If another stowed package quux, has a bar subdirectory, thenwhen stowing, targetdir/bar will be ``split open'' and the contentsof quux/bar will be individually stowed. So far, so good. But whenunstowing quux, targetdir/bar will be removed, even thoughfoo/bar needs it to remain. A workaround for this problem is tocreate a file in foo/bar as a placeholder. If you name that file.placeholder, it will be easy to find and remove such files whenthis bug is fixed.

When using multiple stow directories (see ``Multiple stow directories''in the info manual), Stow fails to ``split open'' tree-folding symlinks(see ``Installing packages'' in the info manual) that point into a stowdirectory which is not the one in use by the current Stowcommand. Before failing, it should search the target of the link tosee whether any element of the path contains a .stow file. If itfinds one, it can ``learn'' about the cooperating stow directory toshort-circuit the .stow search the next time it encounters atree-folding symlink.


This man page was originally constructed by Charles Briscoe-Smith fromparts of Stow's info manual, and then converted to POD format by AdamSpiers. The info manual contains the following notice, which, as itsays, applies to this manual page, too. The text of the sectionentitled ``GNU General Public License'' can be found in the file/usr/share/common-licenses/GPL on any Debian GNU/Linux system. Ifyou don't have access to a Debian system, or the GPL is not there,write to the Free Software Foundation, Inc., 59 Temple Place, Suite330, Boston, MA, 02111-1307, USA. 


Copyright (C)1993, 1994, 1995, 1996 by Bob Glickstein <>;2000, 2001 by Guillaume Morin;2007 by Kahlil Hodgson;2011 by Adam Spiers;and others.

Permission is granted to make and distribute verbatim copies of thismanual provided the copyright notice and this permission notice arepreserved on all copies.

Permission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided also thatthe section entitled ``GNU General Public License'' is included with themodified manual, and provided that the entire resulting derived workis distributed under the terms of a permission notice identical tothis one.

Permission is granted to copy and distribute translations of thismanual into another language, under the above conditions for modifiedversions, except that this permission notice may be stated in atranslation approved by the Free Software Foundation.



Stow will never delete anything that it doesn't own.

This document was created byman2html,using the manual pages.