delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 9258538708A6 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1599006423; | |
bh=kx1i4z3xhd0ipZUC3tv+F+OkeZK3mXLlvy1uVl2q56Y=; | |
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=yt3A+tj6kaDff0QrYPBa8bYNspqtS1JxN6WLZkEyLfFPMiuxtJ2wZVRyAfTKRmDKM | |
tfT93dO+xh4L00XJK4q9rgrVs+c1ejRqrl2qnuxr+ebSoR2v5DcL/S+o33AjqcRw3q | |
OFMnkef1cr74JEVXDQMAavqEneSUMRRrdlhVzPWs= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.3.2 sourceware.org 1650D3857C44 |
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=1e100.net; s=20161025; | |
h=x-gm-message-state:mime-version:references:in-reply-to:from:date | |
:message-id:subject:to:cc; | |
bh=AbR49oa3oKAsXLylYO5DOsRHA/7pvHTFV5Y/BFaCH5Q=; | |
b=jolECvHV3xV3RwEGwhKRWng4XLUJiL0x87KJTGyERptbeKl9rfccmD5zfn28Sg0arJ | |
Ejdwl8QHcOdjNwKYMrvUp8PKegMp7MsHxBskZlwfLr9i7w3ZAFkgglUJCnPtsPiv0/sh | |
YQL4w5ECjhctwUDA3jxg4mbgqk7tsQ/wwOzNqt7uYxv3L6xCSF61mIVd5jOaDtNKMvm+ | |
NtP2d8ZQmH6K3eXQJjQjfvi1kalSj6GEp6OK5j3hWVl3b9xdDWKIirNbTuk2MW47Ir1K | |
ObL/caJRB6EwCwVDNXCvZReiDyHQAUN70ZHnKNE21Ae4sYR3gKGrnmlKBYtVCo67UOmy | |
y0Lw== | |
X-Gm-Message-State: | AOAM531sBcgAKSbRVRxeAibMYGI74q4F9Y+vXGNZ+lmvZvb+nSVp8ypr |
56TDU3cVvdxcSpNOVhXCN+GqkiwkZbHH/Jp6810= | |
X-Google-Smtp-Source: | ABdhPJxOIZF7VcIl8t28nZxCv490BN4JQ6RPJFFokSuVasZVI6y43W15vrJore3mXTi4yu4uMDAeaYa9Y95rpMJJaHo= |
X-Received: | by 2002:a9d:24e3:: with SMTP id z90mr3442133ota.338.1599006419490; |
Tue, 01 Sep 2020 17:26:59 -0700 (PDT) | |
MIME-Version: | 1.0 |
References: | <CAHybJinLYpcviSFiJ=V-EZqoatEzjFfr9DOUzxzmofUmtwMS+w AT mail DOT gmail DOT com> |
<c9792fdc-aedc-6934-e11f-732f841b533b AT SystematicSw DOT ab DOT ca> | |
<CAHybJi=+uKitmwhWfuc564xz6qxZF+H=rA87LaB1NBJPkBAsUA AT mail DOT gmail DOT com> | |
<1464bc69-4dd5-b63d-d1b9-048b52fe036e AT towo DOT net> | |
<dd9d0748-4113-1b88-866c-abcb123e7f27 AT SystematicSw DOT ab DOT ca> | |
<CAHybJikqf2HdOMAfyN0fgNXcNMLWR=5UX_A5yv7cd-mXDgKwCQ AT mail DOT gmail DOT com> | |
<fbf2e661-4424-9dbb-5be1-dd5ff116ca5c AT towo DOT net> | |
In-Reply-To: | <fbf2e661-4424-9dbb-5be1-dd5ff116ca5c@towo.net> |
Date: | Tue, 1 Sep 2020 17:26:48 -0700 |
Message-ID: | <CAHybJimPxpENOXa6VSNSb4T=0niRis=ENi3gUARY_=tw7vqmFQ@mail.gmail.com> |
Subject: | Re: cygwin qsort erratic |
To: | Thomas Wolff <towo AT towo DOT net> |
X-Spam-Status: | No, score=-0.4 required=5.0 tests=BAYES_00, COVID_BODY, |
DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, | |
FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, | |
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 | |
X-Spam-Checker-Version: | SpamAssassin 3.4.2 (2018-09-13) on |
server2.sourceware.org | |
X-Content-Filtered-By: | Mailman/MimeDel 2.1.29 |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.29 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Kurt-Karen Carlson-Lougheed via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Kurt-Karen Carlson-Lougheed <denalisun907 AT gmail DOT com> |
Cc: | cygwin AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces AT cygwin DOT com> |
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 AT towo DOT 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 > -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |