Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12139

Sorting of files in a project's workspace should ignore case

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Jenkins version 1.443

      When browsing the workspace of a project the sort order of files in the directory listing depends on the case of the filenames, which is confusing and wrong.

          [JENKINS-12139] Sorting of files in a project's workspace should ignore case

          Fred G created issue -
          Fred G made changes -
          Description Original: When browsing the workspace of a project the sort order of files in the directory listing depends on the case of the filename, which is confusing and wrong. New: When browsing the workspace of a project the sort order of files in the directory listing depends on the case of the filenames, which is confusing and wrong.

          kutzi added a comment -

          Playing Advocatus Diaboli: why is it confusing and wrong?
          Why should case be ignored? What should be the sort order when there are 2 files which only differ by case?
          Do you have an example maybe to illustrate your case?

          kutzi added a comment - Playing Advocatus Diaboli: why is it confusing and wrong? Why should case be ignored? What should be the sort order when there are 2 files which only differ by case? Do you have an example maybe to illustrate your case?
          Fred G made changes -
          Attachment New: screenshot-1.jpg [ 21337 ]

          Fred G added a comment -

          Sorry, I thought this would be obvious.

          In the attached screenshot you can see the current behavior. This sort order seems odd to me if you compare it to a normal Unix directory listing, where it would be:

          a.txt
          A.txt
          b.txt
          B.txt
          c.txt
          C.txt
          

          Why is it confusing and wrong? Consider a long list of files (several hundred) with different cases (some start with capital letters, some don't) and look for a file (eg. bla.txt). You may not find it where most people would assume it.

          I don't really care which comes first (uppercase or lowercase), but looking at a Unix system again, the file starting with a lowercase character comes first. My patch does not define the order, it just ignores the case and relies on the underlying implementation.

          Apart from that, the sort order of artifacts also ignores the case. So however this may turn out, at least the sort order should be the same across all implementations of directory listings in Jenkins.

          Fred G added a comment - Sorry, I thought this would be obvious. In the attached screenshot you can see the current behavior. This sort order seems odd to me if you compare it to a normal Unix directory listing, where it would be: a.txt A.txt b.txt B.txt c.txt C.txt Why is it confusing and wrong? Consider a long list of files (several hundred) with different cases (some start with capital letters, some don't) and look for a file (eg. bla.txt). You may not find it where most people would assume it. I don't really care which comes first (uppercase or lowercase), but looking at a Unix system again, the file starting with a lowercase character comes first. My patch does not define the order, it just ignores the case and relies on the underlying implementation. Apart from that, the sort order of artifacts also ignores the case. So however this may turn out, at least the sort order should be the same across all implementations of directory listings in Jenkins.

          kutzi added a comment -

          Thanks for explaining. I wasn't aware that sorting works currently like this in Jenkins and I agree that it feels wrong.
          Actually, I think to rely on some existing 'standard' for sorting would work best - i.e. using the same default sort order as Unix systems do would be good.

          kutzi added a comment - Thanks for explaining. I wasn't aware that sorting works currently like this in Jenkins and I agree that it feels wrong. Actually, I think to rely on some existing 'standard' for sorting would work best - i.e. using the same default sort order as Unix systems do would be good.
          Fred G made changes -
          Assignee New: Fred G [ fredg ]
          Fred G made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Fred G added a comment -

          Fred G added a comment - Pull request: https://github.com/jenkinsci/jenkins/pull/333

          I'm quite happy with making the sort order case insensitive but I should point out that the default Unix system sort order is normally case sensitive due to the use of ASCII as the default "C" character encoding.

          This can be changed at runtime according to the system locale.

          Native system "C" locale has uppercase first due to them having a lower character code in ASCII

          richm@humber:/tmp/abc$ LC_ALL=C ls -1 /tmp/abc
          A.txt
          B.txt
          C.txt
          a.txt
          b.txt
          c.txt
          

          The English/British encoding sorts in a case insensitive manner.

          richm@humber:/tmp/abc$ LC_ALL=en_GB ls -1 /tmp/abc
          a.txt
          A.txt
          b.txt
          B.txt
          c.txt
          C.txt
          

          Richard Mortimer added a comment - I'm quite happy with making the sort order case insensitive but I should point out that the default Unix system sort order is normally case sensitive due to the use of ASCII as the default "C" character encoding. This can be changed at runtime according to the system locale. Native system "C" locale has uppercase first due to them having a lower character code in ASCII richm@humber:/tmp/abc$ LC_ALL=C ls -1 /tmp/abc A.txt B.txt C.txt a.txt b.txt c.txt The English/British encoding sorts in a case insensitive manner. richm@humber:/tmp/abc$ LC_ALL=en_GB ls -1 /tmp/abc a.txt A.txt b.txt B.txt c.txt C.txt

            kutzi kutzi
            fredg Fred G
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: