News for hackers. Stuff that matters.
Re:The Source History of Cat by akkartik on Monday November 12, 2018 @10:38PM (#18438344)
Interesting to think what a different conclusion the article would have arrived at if he'd chosen to look at GNU cat on Linux. A few sample points:

* 2002: 833 LoC (http://landley.net/aboriginal/history.html)

* 2013: 36kLoC, 2/3rds of them .h files (https://news.ycombinator.com/item?id=11340510#11341175)

* 2018: 37kLoC of .c file dependencies going into libcoreutils.a and some LoC of .h files (coreutils has 60kLoC of .h files)

The methodology for counting lines likely isn't consistent across those data points. But the trend is still unmistakeable. Maybe I'll tree-shake all the dead code out and come up with an accurate line count one of these days..

Re:The Source History of Cat by akkartik on Tuesday November 13, 2018 @03:41PM (#18444691)
I just performed an ad hoc file-level tree-shaking for 'src/cat.c' in GNU coreutils 8.30, starting with `gcc src/cat.c` and gradually adding arguments until I got it to build. Here's the command I ended up with.

    gcc -I. -I./lib /
      src/version.c /
      lib/progname.c /
      lib/safe-read.c /
      lib/safe-write.c /
      lib/quotearg.c /
      lib/xmalloc.c /
      lib/localcharset.c /
      lib/c-strcasecmp.c /
      lib/mbrtowc.c /
      lib/xalloc-die.c /
      lib/c-ctype.c /
      lib/hard-locale.c /
      lib/exitfail.c /
      lib/closeout.c /
      lib/close-stream.c /
      lib/fclose.c /
      lib/fflush.c /
      lib/fseeko.c /
      lib/version-etc.c /
      lib/xbinary-io.c /
      lib/version-etc-fsf.c /
      lib/binary-io.c /
      lib/fadvise.c /
      lib/full-write.c /
      src/cat.c
Those .c files add up to 5021 lines.

The .c files include 44 header files:

    lib/binary-io.h
    lib/c-ctype.h
    lib/closeout.h
    lib/close-stream.h
    lib/config.h
    lib/c-strcaseeq.h
    lib/c-strcase.h
    lib/ctype.h
    lib/error.h
    lib/exitfail.h
    lib/fadvise.h
    lib/fcntl.h
    lib/fpending.h
    lib/freading.h
    lib/full-write.h
    lib/gettext.h
    lib/hard-locale.h
    lib/ignore-value.h
    lib/limits.h
    lib/localcharset.h
    lib/locale.h
    lib/minmax.h
    lib/progname.h
    lib/quotearg.h
    lib/quote.h
    lib/safe-read.h
    lib/stdio.h
    lib/stdio-impl.h
    lib/stdlib.h
    lib/string.h
    lib/sys/ioctl.h
    lib/sys-limits.h
    lib/sys/types.h
    lib/unistd.h
    lib/unused-parameter.h
    lib/verify.h
    lib/version-etc.h
    lib/wchar.h
    lib/wctype.h
    lib/xalloc.h
    lib/xbinary-io.h
    src/die.h
    src/ioblksize.h
    src/system.h
The header files add up to 19.7k lines.

So the total line count for files GNU cat actually needs to build is at least ~25k.

(I didn't bother checking for headers including other headers.)

Next step: do this for various versions of GNU coreutils.

Re:The Source History of Cat by rurban on Wednesday November 14, 2018 @03:00AM (#18448306)
Much more code for much less functionality than the BSD cat which can do sockets. Not surprised at all.
Re:The Source History of Cat by rain1 on Tuesday November 13, 2018 @07:28PM (#18446237)
Thanks for taking the time to do this counting, very interesting result.
Re:The Source History of Cat by arminiusreturns on Tuesday November 13, 2018 @08:37AM (#18440802)
This is why I think the movement of the future will be about going back and stripping cruft out of old codebases. We've seen the weaknesses of the bazaar/ many eyes, and the main one IMHO is code complexity, which is often easiest to measure in loc.