Skip to content

BUG - generate changelog does not work with linux sort command (does not sort correctly) #447

Open
@reactive-firewall

Description

@reactive-firewall

Describe the bug

A clear and concise description of what the bug is.

generate_changelog.sh expects BSD sort for sorting what is called dictionary order (e.g. -d) however on ubuntu it seems that the sort command (unknown version for now) does not sort the change-log entries correctly or even consistently at all.

To Reproduce

Steps to reproduce the behavior:

  1. use BSD sort environment (e.g. macOS) to run generate_changelog.sh HEAD...stable > /tmp/bsd_changelog.txt
  2. use Ubuntu sort environment to run generate_changelog.sh HEAD...stable > /tmp/linux_changelog.txt
  3. collect both bsd_changelog.txt and linux_changelog.txt into a single environment and check with git diff --no-index bsd_changelog.txt linux_changelog.txt
  4. See error in sorting

Expected behavior

A clear and concise description of what you expected to happen.

There should not be such a difference between the generated change-logs that the majority of the contents are sorted differently (a few differences in very similar lines would be fine, but not un-sorted)

should probably add function to sort, check sorted, and loop until working or fail at timeout

  graph TD;
    input-->BUFFER;
    BUFFER-->sort;
    sort-->BUFFER;
    BUFFER-->output;
Loading
sequenceDiagram
  participant script as "generate_changelog.sh"
  participant func as Sort Function

  script->>func: call function with INPUT
  create participant BUFFER as string buffer
  func-->>BUFFER: Initialize buffer with INPUT
  loop: while unsorted
    create participant Sort as sort command
    func-->>Sort: sort buffer
    BUFFER->>Sort: does sort stuff
    Sort-->>BUFFER: update BUFFER with sorted results
    Sort->>func: done
    func-->>Sort: check buffer is indeed sorted
    BUFFER->>Sort: does sort check stuff
    alt if sorted
      Sort->>func: buffer is sorted
      func-->>func: Exit Loop
    else not sorted
      destroy Sort
      Sort->>func: buffer is Unsorted
      func-->>func: Continue Loop
    end
  end
  destroy BUFFER
  BUFFER->>func: drain buffer as output
  func->>script: return sorted output
Loading

Additional context (optional)

  • see generate_changelog.sh

Namely:

' <"${CHANGELOG_BUFFER}" | sort -id | uniq | sort -rd

Metadata

Metadata

Labels

Bash LangChanges to the BASH scriptsCIContinuous Integration ToolingTestingSomething can be verifiedbugSomething isn't working

Type

Projects

Status

To do

Relationships

None yet

Development

No branches or pull requests

Issue actions