public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kurt-Karen Carlson-Lougheed <denalisun907@gmail.com>
To: Thomas Wolff <towo@towo.net>
Cc: cygwin@cygwin.com
Subject: Re: cygwin qsort erratic
Date: Tue, 1 Sep 2020 17:26:48 -0700	[thread overview]
Message-ID: <CAHybJimPxpENOXa6VSNSb4T=0niRis=ENi3gUARY_=tw7vqmFQ@mail.gmail.com> (raw)
In-Reply-To: <fbf2e661-4424-9dbb-5be1-dd5ff116ca5c@towo.net>

Thomas:
As stated, twice, the full code is on SourceForge as uac19 v3.3. If you
need me to send you a tgz with sample data please let me know, but note the
comments and patch below. I can certainly walk you through reproducing the
problem if you believe that is worthwhile.

Stephen:
Thank you. I couldn't get the 'blame' to work (I am not git savvy), but I
got the cygwin qsort.c. The problem is *EXACTLY* as described by Dennis de
Champeaux in the 2015-01-11 cygwin list posting. The secondary insertion
sort attempt is not safe. I patched as follows, the de Champeaux is code is
more correct in removing swap_cnt as it is no longer used:

kc: diff -u qsort.c cygsort.c
--- qsort.c     2020-09-01 15:36:39.716029300 -0700
+++ cygsort.c   2020-09-01 16:47:30.152545600 -0700
@@ -252,14 +252,15 @@
                pb += es;
                pc -= es;
        }
-       if (swap_cnt == 0) {  /* Switch to insertion sort */
+/* kc
+       if (swap_cnt == 0) {  // Switch to insertion sort
                for (pm = (char *) a + es; pm < (char *) a + n * es; pm +=
es)
                        for (pl = pm; pl > (char *) a && CMP(thunk, pl -
es, pl) > 0;
                             pl -= es)
                                swap(pl, pl - es);
                goto pop;
        }
-
+kc */
        /*
         * Rearrange the array in three parts sorted like this:
         * { elements < pivot, elements == pivot, elements > pivot }

If you need me to provide further information, please advise.
Regards, kurt

On Tue, Sep 1, 2020 at 3:02 PM Thomas Wolff <towo@towo.net> wrote:

> Am 01.09.2020 um 22:29 schrieb Kurt-Karen Carlson-Lougheed via Cygwin:
> >    Brian:
> > 1. The Qsort() source I sent was from netbsd.org, NOT cygwin. netbsd
> works.
> > 2. Complete package is on SourceForge as uac19 v3.3. I'm happy to send a
> > tgz if you prefer that. Read 3 choices at end before considering this.
> > 3. Data is curl'd from owid as shown in the script example. Likewise I
> can
> > send a sample data set. The program analyzes COVID-19 csv files from
> either
> > owid or github/nytimes
> > 4. I've used qsort() for years. I agree, keeping the sort routines simple
> > is always appropriate. I confirmed today the only ones that fail include
> > float divides, lDsort() and lXsort() in attached c19sort.c. When it's
> > pre-calculated and added to the struct it works, the code has a toggle
> now
> > for testing that.
> >
> > Thomas:
> > I tried (again) today  to build a simple test case. The data structures
> in
> > use are complex, probably the only thing I can attempt is stripping down
> > the code which will be very time consuming. I know you don't know me at
> > all, but I've written code, debugged proprietary operating systems
> > (assembler), performed OS dump analysis, troubleshot intermittent
> hardware
> > issues, identified disk firmware issues causing intermittent data
> > corruption, identified nfs performance issues, managed large hpc
> clusters,
> > etc. etc. etc. over 40+ years.
> Your code does not even compile. I did not ask for a minimal test case
> although that is generally appreciated. But a working test case at least
> is required to establlish your claim of a bug.
> >
> > I see three choices:
> > A. One of you look at simple the qqsort wrapper. I modified my code to
> > toggle between the functional netbsd Qsort() and cygwin qsort(). I have
> > demonstrated erroneous results coming from the cygwin version in a small
> > percentage of requests. If you can acknowledge that, perhaps you can
> check
> > the cygwin version of qsort() vs. the current netbsd.org?
> > B. If you could kindly provide me or point me to the cygwin qsort()
> source
> > I'll check it out myself.
> > C. We can thank each other and leave cygwin's qsort() as is broken in
> some
> > small number of circumstances since I've compiled netbsd's into my code
> and
> > that always works.
> >
> > Regards, kurt
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
>

  reply	other threads:[~2020-09-02  0:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30 21:27 Kurt-Karen Carlson-Lougheed
2020-08-31  2:54 ` Brian Inglis
2020-08-31 17:50   ` Kurt-Karen Carlson-Lougheed
2020-08-31 18:00     ` Thomas Wolff
2020-08-31 18:50       ` Brian Inglis
2020-09-01 20:29         ` Kurt-Karen Carlson-Lougheed
2020-09-01 20:55           ` Stephen John Smoogen
2020-09-01 22:00           ` Thomas Wolff
2020-09-02  0:26             ` Kurt-Karen Carlson-Lougheed [this message]
2020-09-02  7:23               ` Thomas Wolff
2020-08-31  7:31 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHybJimPxpENOXa6VSNSb4T=0niRis=ENi3gUARY_=tw7vqmFQ@mail.gmail.com' \
    --to=denalisun907@gmail.com \
    --cc=cygwin@cygwin.com \
    --cc=towo@towo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).