Browse Source

Revert pre-pending behavior of saturnin__conf_mkpath()

Turns out this was not a good idea as it would too easy to trigger.
If a saturnin sub-command was called from within itself (or another other
sub-command), the $SATURNIN_CONF_PATH computed earlier would just double,
leading to unwanted behavior of saturnin__conf_find(), which would find
items twice.

The original problem should be adressed another way; the testing case
be covered by either writing tests on a lower level; eg. unit tests
and use saturnin__conf_find() or saturnin__conf() without forking.

Another solution on part of Saturnin could be to introduce different
variable (e.g. SATURNIN_CONF_DIRS) for values computed by launcher
and keep $SATURNIN_CONF_PATH just for user.
Alois Mahdal 6 years ago
parent
commit
78afe70525
1 changed files with 2 additions and 4 deletions
  1. 2
    4
      src/saturnin.sh.skel

+ 2
- 4
src/saturnin.sh.skel View File

@@ -408,14 +408,13 @@ saturnin__help() {
408 408
 
409 409
 saturnin__conf_mkpath() {
410 410
     #
411
-    # Print new $SATURNIN_CONF_PATH by appending locations $@
411
+    # Compose new value for $SATURNIN_CONF_PATH from locations $@
412 412
     #
413 413
     # Usage:
414 414
     #
415 415
     #     saturnin__conf_mkpath DIR [DIR..]
416 416
     #
417
-    # First repeat elements of $SATURNIN_CONF_PATH unless it's empty.
418
-    # Then go through each DIR and print it, unless it ends with "/ini.d",
417
+    # Go through each DIR and print it, unless it ends with "/ini.d",
419 418
     # in which case list its subdirectories, sorted by C locale (this allows
420 419
     # for modular configuration).
421 420
     #
@@ -423,7 +422,6 @@ saturnin__conf_mkpath() {
423 422
     #
424 423
     local location      # one location argument
425 424
     local path          # one path listed
426
-    test -n "$SATURNIN_CONF_PATH" && echo -n "$SATURNIN_CONF_PATH:"
427 425
     for location in "$@";
428 426
     do
429 427
         test -d "$location" || continue