Project

General

Profile

Bug #11431

sort: NULL pointer errors

Added by Toomas Soome about 1 month ago. Updated 15 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Build errors with NULL pointer:

    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/mman.h:54,
                     from ../common/utility.h:36,
                     from ../common/utility.c:29:
    ../common/utility.c: In function 'wxwrite':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 1 of 'cxwrite' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../common/utility.c:559:19: note: in expansion of macro 'NULL'
       return (cxwrite(NULL, 0, 1));
                       ^~~~
    ../common/utility.c:494:1: note: expected 'int' but argument is of type 'void *'
     cxwrite(int fd, char *ptr, size_t nbytes)
     ^~~~~~~
    cc1: all warnings being treated as errors

History

#1

Updated by Toomas Soome 15 days ago

Test case with dtrace:

tsoome@beastie:~$ sudo dtrace -n 'pid$target:sort:wxwrite:entry {printf("fd: %d buf %p\n", (int)arg0, (char *)arg1);}' -c '/bin/amd64/sort test.txt' 
dtrace: description 'pid$target:sort:wxwrite:entry ' matched 1 probe
á
é
í
ó
š
ž
õ
ä
ö
ü
dtrace: pid 20441 has exited
CPU     ID                    FUNCTION:NAME
  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00030

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00038

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00048

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00040

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00020

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00028

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00000

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00010

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00018

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fe5c00008

  5  86424                    wxwrite:entry fd: 1 buf fffffd7fffdf85a8

tsoome@beastie:~$ 

#2

Updated by Electric Monk 15 days ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 987bce4514168c128e42feae3a7c308872fd4bea

commit  987bce4514168c128e42feae3a7c308872fd4bea
Author: Toomas Soome <tsoome@me.com>
Date:   2019-08-06T15:19:06.000Z

    11431 sort: NULL pointer errors
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF