Procházet zdrojové kódy

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 před 6 roky
rodič
revize
78afe70525
1 změnil soubory, kde provedl 2 přidání a 4 odebrání
  1. 2
    4
      src/saturnin.sh.skel

+ 2
- 4
src/saturnin.sh.skel Zobrazit soubor

408
 
408
 
409
 saturnin__conf_mkpath() {
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
     # Usage:
413
     # Usage:
414
     #
414
     #
415
     #     saturnin__conf_mkpath DIR [DIR..]
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
     # in which case list its subdirectories, sorted by C locale (this allows
418
     # in which case list its subdirectories, sorted by C locale (this allows
420
     # for modular configuration).
419
     # for modular configuration).
421
     #
420
     #
423
     #
422
     #
424
     local location      # one location argument
423
     local location      # one location argument
425
     local path          # one path listed
424
     local path          # one path listed
426
-    test -n "$SATURNIN_CONF_PATH" && echo -n "$SATURNIN_CONF_PATH:"
427
     for location in "$@";
425
     for location in "$@";
428
     do
426
     do
429
         test -d "$location" || continue
427
         test -d "$location" || continue