Skip to content

sort -u not behaving the same between coreutils and uutils (a rewrite of coreutils in Rust) #999

Description

@pyke369

Description

Two different versions of the sort tool apparently do not behave the same, and this is problematic on how dehydrated handle certificates with wildcard ("star") domain aliases. For instance when you have such following line in the domains.txt file:

domain.com *.domain.com > domain.com

the normalize_san_list() function (and the inlined code before it existed) thinks the certificate needs to be renewed b/c the SAN list appear to have changed:

Processing domain.com with alternative names: *.domain.com
 + Checking domain name(s) of existing cert... changed!
 + Domain name(s) are not matching!
 + Names in old certificate: *.domain.com
 + Configured names: domain.com
 + Forcing renew.

Problem

With coreutils sort:

$ (echo 'domain.com'; echo '*.domain.com'; echo 'domain.com') | sort -u
*.domain.com
domain.com

With uutils sort:

$ (echo 'domain.com'; echo '*.domain.com'; echo 'domain.com') | sort -u
domain.com    <--- the additional wildcard domain is silently discarded

Solution

Add -i (and optionnally -s) option(s) to the existsing -u option.

With coreutils sort:

$ (echo 'domain.com'; echo '*.domain.com'; echo 'domain.com') | sort -uis
*.domain.com
domain.com

With uutils sort:

$ (echo 'domain.com'; echo '*.domain.com'; echo 'domain.com') | sort -uis
*.domain.com
domain.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions