public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
@ 2011-10-23  8:17 ` bugdal at aerifal dot cx
  2012-12-19 10:47 ` schwab@linux-m68k.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: bugdal at aerifal dot cx @ 2011-10-23  8:17 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=10672

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx
          Component|libc                        |manual

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> 2011-10-23 08:17:07 UTC ---
This is a bug in the manual. The text about using the address as part of the
comparison function is not only ineffective but actually results in undefined
behavior due to violation of the requirements on comparison functions. It
should just be removed.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
  2011-10-23  8:17 ` [Bug manual/10672] qsort may not be a stable sort under memory exhaustion bugdal at aerifal dot cx
@ 2012-12-19 10:47 ` schwab@linux-m68k.org
  2014-03-11  7:07 ` allachan at au1 dot ibm.com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2012-12-19 10:47 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=10672

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|drepper.fsp at gmail dot    |unassigned at sourceware
                   |com                         |dot org

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
  2011-10-23  8:17 ` [Bug manual/10672] qsort may not be a stable sort under memory exhaustion bugdal at aerifal dot cx
  2012-12-19 10:47 ` schwab@linux-m68k.org
@ 2014-03-11  7:07 ` allachan at au1 dot ibm.com
  2014-07-01  6:49 ` fweimer at redhat dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: allachan at au1 dot ibm.com @ 2014-03-11  7:07 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10672

paxdiablo <allachan at au1 dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |allachan at au1 dot ibm.com

--- Comment #3 from paxdiablo <allachan at au1 dot ibm.com> ---
It's a well known trick that you can make an unstable sort like Quicksort into
a stable one by adding an address to the comparison key as the most minor
component.

However, this must be the STARTING address of each element and must be
populated before the sort proper starts with something like:

for (int i = 0; i < sz; i++) elem[i].startaddr = &(elem[i]);

By using the starting address as the most minor part of the key, the order of
otherwise similarly-keyed elements will be preserved.

Using the TRANSITORY address will not work and in fact will break the sort
contract as sometimes a will be less than b and sometimes vice versa, depending
on their current address in memory. So, yes, that section of the documentation
is dead wrong and should be removed or fixed.

And, in fact, qsort() is not REQUIRED to be stable as per the ISO C standard.
If you WANT a stable sort, go grab a copy of Mergesort from somewhere.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-03-11  7:07 ` allachan at au1 dot ibm.com
@ 2014-07-01  6:49 ` fweimer at redhat dot com
  2014-07-01  7:05 ` andersk at mit dot edu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-07-01  6:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10672

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-07-01  6:49 ` fweimer at redhat dot com
@ 2014-07-01  7:05 ` andersk at mit dot edu
  2014-07-01  8:11 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: andersk at mit dot edu @ 2014-07-01  7:05 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10672

--- Comment #4 from Anders Kaseorg <andersk at mit dot edu> ---
Created attachment 7665
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7665&action=edit
Remove incorrect claim from manual

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-07-01  7:05 ` andersk at mit dot edu
@ 2014-07-01  8:11 ` fweimer at redhat dot com
  2014-07-01  8:15 ` andersk at mit dot edu
  2014-12-10 15:50 ` neleai at seznam dot cz
  7 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-07-01  8:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10672

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Anders Kaseorg from comment #4)
> Created attachment 7665 [details]
> Remove incorrect claim from manual

Could you post this patch to the mailing list for review, please?

I think it is best to remove the problematic wording altogether, not attempting
to describe the past behavior of the implementation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-07-01  8:11 ` fweimer at redhat dot com
@ 2014-07-01  8:15 ` andersk at mit dot edu
  2014-12-10 15:50 ` neleai at seznam dot cz
  7 siblings, 0 replies; 8+ messages in thread
From: andersk at mit dot edu @ 2014-07-01  8:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10672

--- Comment #6 from Anders Kaseorg <andersk at mit dot edu> ---
Posted: https://sourceware.org/ml/libc-alpha/2014-07/msg00002.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug manual/10672] qsort may not be a stable sort under memory exhaustion
       [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2014-07-01  8:15 ` andersk at mit dot edu
@ 2014-12-10 15:50 ` neleai at seznam dot cz
  7 siblings, 0 replies; 8+ messages in thread
From: neleai at seznam dot cz @ 2014-12-10 15:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10672

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |neleai at seznam dot cz
         Resolution|---                         |FIXED

--- Comment #7 from Ondrej Bilka <neleai at seznam dot cz> ---
fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-10 15:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-10672-131@http.sourceware.org/bugzilla/>
2011-10-23  8:17 ` [Bug manual/10672] qsort may not be a stable sort under memory exhaustion bugdal at aerifal dot cx
2012-12-19 10:47 ` schwab@linux-m68k.org
2014-03-11  7:07 ` allachan at au1 dot ibm.com
2014-07-01  6:49 ` fweimer at redhat dot com
2014-07-01  7:05 ` andersk at mit dot edu
2014-07-01  8:11 ` fweimer at redhat dot com
2014-07-01  8:15 ` andersk at mit dot edu
2014-12-10 15:50 ` neleai at seznam dot cz

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).