X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7C6C33851C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=towo.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=towo AT towo DOT net Subject: Re: cygwin qsort erratic To: Kurt-Karen Carlson-Lougheed , cygwin AT cygwin DOT com References: <1464bc69-4dd5-b63d-d1b9-048b52fe036e AT towo DOT net> From: Thomas Wolff X-Tagtoolbar-Keys: D20200902092327557 Message-ID: Date: Wed, 2 Sep 2020 09:23:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K1:lFd2R3TUVokwEXpLJVdQZvmqklXx5DuqWRWWaQ1DSeMqsxI+3se DyLW6d9QFCCxvMav94TZR7gXqGG+NLco/V8JSsBsT9R1D6VCNR40rRbfenZvSdcdeD5WhSl edDuSpnV9Zx0+P5Q20+h9ae8gsEG3KsW08CpvfgA+Q4ILt8wE+H1cawAR9WpeNxg/OVWBPb GguBK3djmwV+VGszS9LLA== X-UI-Out-Filterresults: notjunk:1;V03:K0:IYnqsHLQwFw=:b2A/lZMpVy50GL2ezssCBp qkIBgHNu96i3hlkit14dqLrERzJqRdL7IefY6LfEgA/qiQKoHrawd5DuGVxQHEMct0Yd/l9WB zZPe8/7JatzgUBi1QpAbAnayUGvwhYLlFhLf/dS7TEhu+XQfdibDj5KFXMtxKZvMgK3NhH7ok EyFYoxewji1QFGuASSn8IYpQomIVF+UjMZrW3CgcpLxy1GmXSihbo16eX3aweeEoTSkGyBfSc XrT/g36j/dZB3x3gOLgkXIfcmx6xrUQtya3uabzeRgewI9iJQssVmZ0j5idOOstE5Prj/1bMr 5CJJfmtAKutj9MasX8XcJSmpBJVI6slQBtY05/P9NCWuAtisgE55ifNl8LyIU8mEt2kSJ2MvH CgevJIkXsvoezmQaHH1U7ejYL2QWhS8T0tnVWk23JkQdU/rxGjkONK3GWDlt7zxEm8JBVq31p m4y9vly3Z8BIpFr8sEpItuq5CMiwC+MO2igs24f83/rK+WSW0t9u5ldo+sYTtataPLMYhUuy0 rIxWi/jj3QWVU9T3jhmAlEpwuW8TDzQRpFxXYvc1Izg6JUzvczL1ytJBSINjRjWEugMq1nN7w Dx1jN22BHgd/1t2U6A0t+AA20eu7k3l5SYlriZbYxDQtp6YzbGvXwSCRQiNkzjwQjFsr2PpHT 2mDKrRo/TnQVyqoykDQl3NQ4F/YrqMCo1zf0MzKk7lWVkxxYMLKSAMTOgH45Z8+SiDDRMT7H7 XEvcN949ichr02lV6wtKhj7wPPb5bMkLuoj7JmhUoss1+aQ6PlmjLE4Eg5fEWYXcrerjuWeyh qT6ztm5LPm6zyZZUhzrdH3FzIUQnDkNn3y1HaSR+StJBalvlw7e6uvKhr12PjdDStzVN++X X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00, COVID_BODY, HTML_MESSAGE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 0827O0ZD019927 Am 02.09.2020 um 02:26 schrieb Kurt-Karen Carlson-Lougheed: > 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. Kurt-Karen: I am not uac savvy. The proposal to dig out some software package, build it (which may create hours-long trouble in some cases), collect data from somewhere else etc, to reproduce an assumed bug, is not appropriate. It's your term to provide a single, reproducible demonstration of a bug. If this were an issue in my project, I would close it now for refusal of cooperation. > > 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 > 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