Skip to content

Commit

Permalink
sh: fix missing +x attr
Browse files Browse the repository at this point in the history
  • Loading branch information
sahib committed Oct 30, 2018
2 parents 78a2edc + 017b007 commit 8a2fde2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
45 changes: 23 additions & 22 deletions docs/rmlint.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ output (for example a shell script) to help you delete the files if you want
to. Another design principle is that it should work well together with other
tools like ``find``. Therefore we do not replicate features of other well know
programs, as for example pattern matching and finding duplicate filenames.
However we provide many convinience options for common usecases that are hard
However we provide many convinience options for common use cases that are hard
to build from scratch with standard tools.

In order to find the lint, ``rmlint`` is given one or more directories to traverse.
If no directories or files were given, the current working directory is assumed.
By default, ``rmlint`` will ignore hidden files and will not follow symlinks (see
traversal options below). ``rmlint`` will first find "other lint" and then search
`Traversal Options`_). ``rmlint`` will first find "other lint" and then search
the remaining files for duplicates.

``rmlint`` tries to be helpful by guessing what file of a group of duplicates
is the **original** (i.e. the file that should not be deleted). It does this by using
different sorting strategies that can be controlled via the ``-S`` option. By
default it chooses the first-named path on the commandline. If two duplicates
come from the same path, it will also apply different fallback sort strategies (See the documentation of the ``-S`` strategy).
come from the same path, it will also apply different fallback sort strategies
(See the documentation of the ``-S`` strategy).

This behaviour can be also overwritten if you know that a certain directory
contains duplicates and another one originals. In this case you write the
Expand Down Expand Up @@ -99,10 +100,10 @@ General Options
double quotes. In obscure cases argument parsing might fail in weird ways,
especially when using spaces as separator.

Example:
Example::

``$ rmlint -T "df,dd" # Only search for duplicate files and directories``
``$ rmlint -T "all -df -dd" # Search for all lint except duplicate files and dirs.``
$ rmlint -T "df,dd" # Only search for duplicate files and directories
$ rmlint -T "all -df -dd" # Search for all lint except duplicate files and dirs.

:``-o --output=spec`` / ``-O --add-output=spec`` (**default\:** *-o sh\:rmlint.sh -o pretty\:stdout -o summary\:stdout -o json\:rmlint.json*):

Expand All @@ -118,10 +119,10 @@ General Options
specified multiple times to get multiple outputs, including multiple
outputs of the same format.

Examples:
Examples::

``$ rmlint -o json # Stream the json output to stdout``
``$ rmlint -O csv:/tmp/rmlint.csv # Output an extra csv fle to /tmp``
$ rmlint -o json # Stream the json output to stdout
$ rmlint -O csv:/tmp/rmlint.csv # Output an extra csv fle to /tmp

:``-c --config=spec[=value]`` (**default\:** *none*):

Expand All @@ -131,10 +132,10 @@ General Options

If the value is omitted it is set to a value meaning "enabled".

Examples:
Examples::

``$ rmlint -c sh:link # Smartly link duplicates instead of removing``
``$ rmlint -c progressbar:fancy # Use a different theme for the progressbar``
$ rmlint -c sh:link # Smartly link duplicates instead of removing
$ rmlint -c progressbar:fancy # Use a different theme for the progressbar

:``-z --perms[=[rwx]]`` (**default\:** *no check*):

Expand Down Expand Up @@ -162,14 +163,14 @@ General Options

**highway**, **md**

**metro**, **murmur**, *xxhash**
**metro**, **murmur**, **xxhash**

The weaker hash functions still offer excellent distribution properties, but are potentially
more vulnerable to *malicious* crafting of duplicate files.

The full list of hash functions (in decreasing order of checksum length) is:

512-bit: **blake2b**, **blake2bp**, **sha3-512, **sha512**
512-bit: **blake2b**, **blake2bp**, **sha3-512**, **sha512**

384-bit: **sha3-384**,

Expand Down Expand Up @@ -502,12 +503,12 @@ Caching

By design, some options will not have any effect. Those are:

- `--followlinks`
- `--algorithm`
- `--paranoid`
- `--clamp-low`
- `--hardlinked`
- `--write-unfinished`
- ``--followlinks``
- ``--algorithm``
- ``--paranoid``
- ``--clamp-low``
- ``--hardlinked``
- ``--write-unfinished``
- ... and all other caching options below.

*NOTE:* In ``--replay`` mode, a new ``.json`` file will be written to
Expand All @@ -526,7 +527,7 @@ Caching
Also, this is a linux specific feature that works not on all filesystems and
only if you have write permissions to the file.

Usage example: ::
Usage example::

$ rmlint large_file_cluster/ -U --xattr-write # first run.
$ rmlint large_file_cluster/ --xattr-read # second run.
Expand Down Expand Up @@ -562,7 +563,7 @@ Rarely used, miscellaneous options
The ``size``-description has the same format as for **--size**, therefore you
can do something like this (use this if you have 1GB of memory available):

``$ rmlint -u 512M # Limit paranoid mem usage to 512 MB```
``$ rmlint -u 512M # Limit paranoid mem usage to 512 MB``

:``-q --clamp-low=[fac.tor|percent%|offset]`` (**default\:** *0*) / ``-Q --clamp-top=[fac.tor|percent%|offset]`` (**default\:** *1.0*):

Expand Down
6 changes: 2 additions & 4 deletions lib/formats/sh.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,8 @@ static void rm_fmt_head(RmSession *session, RmFmtHandler *parent, FILE *out) {
rm_sh_parse_handlers(self, "cmd,remove");
}

if(parent->file_existed_already == false) {
if(fchmod(fileno(out), S_IRUSR | S_IWUSR | S_IXUSR) == -1) {
rm_log_perror("Could not chmod +x sh script");
}
if(fchmod(fileno(out), S_IRUSR | S_IWUSR | S_IXUSR) == -1) {
rm_log_perror("Could not chmod +x sh script");
}

char *equal_extra_args = rm_fmt_sh_get_extra_equal_args(session);
Expand Down

0 comments on commit 8a2fde2

Please sign in to comment.