diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-02-08 17:13:23 +0100 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-02-08 17:39:00 +0100 |
| commit | f8ef1a73e872ad9b3e3a8936b0ddc18217cbe2ba (patch) | |
| tree | ecb1d316735807d763482d649ccc6f992fc19862 /docs/rabbitmq-service.xml | |
| parent | 60fe60d08d0213f3345ea8a50bac239e0dda2218 (diff) | |
| download | rabbitmq-server-git-f8ef1a73e872ad9b3e3a8936b0ddc18217cbe2ba.tar.gz | |
Makefile: Use pax(1) to copy escripts from rabbitmq-cli
Before this change, we used cp(1) and its `-r` flag to copy the source
directory recursively. Pretty standard.
We are using hardlinks in the source directory because all escripts are
the same code: the program uses the filename to determine the behavior.
Pretty standard too. We settled on hardlinks, not symlinks, because on
Windows, you need elevated privileges to use symlinks apparently.
Unfortunately, `cp -r` treats those hardlinks as separate files. thus
the destination directory contains three distinct copies of the same
file:
$ ls -l escript/
-rwxr-xr-x 1 dumbbell dumbbell 4545805 Feb 8 17:25 rabbitmq-diagnostics
-rwxr-xr-x 1 dumbbell dumbbell 4545805 Feb 8 17:25 rabbitmq-plugins
-rwxr-xr-x 1 dumbbell dumbbell 4545805 Feb 8 17:25 rabbitmqctl
^---- Single references to distinct files
$ du -sh escript/
13M escript/
I first tried with `-a` (cp(1) archive mode) instead of `-r`, but
the behavior is inconsistent accross platforms. GNU coreutils' cp(1)
preserves hardlinks as I would expect, but BSD cp does not. Indeed `-a`
isn't a standard option. BSD cp's manpage documents the behavior and
suggests to use tar(1), cpio(1) or pax(1) when hardlinks are meant to be
preserved.
tar(1) and cpio(1) are unavailable by default in MSYS2 (used on
Windows), but pax(1) is. So now, we use pax(1) to copy the escript
source directory and hardlinks are preserved on all platforms, including
Windows.
$ ls -l escript/
-rwxr-xr-x 3 dumbbell dumbbell 4545805 Feb 8 13:53 rabbitmq-diagnostics
-rwxr-xr-x 3 dumbbell dumbbell 4545805 Feb 8 13:53 rabbitmq-plugins
-rwxr-xr-x 3 dumbbell dumbbell 4545805 Feb 8 13:53 rabbitmqctl
^---- Three references to a single file
$ du -sh escript/
4.4M escript/
[#138925175]
Diffstat (limited to 'docs/rabbitmq-service.xml')
0 files changed, 0 insertions, 0 deletions
