Skip to content

Commit

Permalink
sort entity list again before giving it to comm(1)
Browse files Browse the repository at this point in the history
Apparently `holo scan` sorts stuff differently than sort(1).
In particular, I see that `holo scan --short` on one of my servers lists

  file:/etc/munin/munin-node.conf
  file:/etc/munin/munin.conf

in that order, but `holo scan --short | sort` puts it the other way
around.
  • Loading branch information
majewsky committed Mar 18, 2017
1 parent 39a214e commit 58a6627
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/distribution-integration/alpm-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ comm -12 \
<(# changed files come from stdin (but without leading slash!)
sort | sed 's+^+/+') \
<(# enumerate files that are managed by holo-files
holo scan --short | sed -n 's/^file://p') \
holo scan --short | sed -n 's/^file://p' | sort) \
| sed 's/^/file:/' | xargs -r holo apply

1 comment on commit 58a6627

@LukeShu
Copy link
Contributor

@LukeShu LukeShu commented on 58a6627 Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting LC_COLLATE=C should make the ordering expected/produced by comm(1)/sort(1) match Go's sort ordering. But just piping it through sort(1) is probably more robust, in case there ever is a discrepancy.

For the example, I've verified that the ordering disagrees for LANG=en_US.UTF-8, and that setting LC_COLLATE=C for comm resolves the disagreement.

Please sign in to comment.