Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20261118125553.9133-1-ilt@envs.net>
Date: Wed, 18 Nov 2026 15:49:42 +0300
From: illiliti <ilt@...s.net>
To: musl@...ts.openwall.com
Cc: illiliti <ilt@...s.net>
Subject: [PATCH v1 00/18] Add fts

The fts interface is available at least in glibc, uclibc, *BSD,
Solaris/Illumos. Its usage is also very widespread.

https://codesearch.debian.net/search?q=fts_open&literal=1

This search result shows that at least 115 packages are using fts.

In order to reduce downstream code duplication and provide a
high-quality fts implementation in musl, I propose that we consider
upstreaming it.

The first commit is a copy of the fts from the NetBSD tree; the rest are
adjustments that remove non-portable code. Each change is deliberately
made as a separate commit, so you can easily diff the code against
NetBSD fts and see what's changed. The last few commits are cherrypicks
from other BSDs which harden the code and improve reliability.

I intentionally refrained from making a major code cleanup to avoid
introducing potentially breaking and incompatible changes. Instead,
I'd prefer to do that gradually in v2 if I get the green light to
proceed.

Since the initial implementation originated from 4.4 BSD, the code
is licensed under the permissive 3-clause BSD. I hope that's OK.

illiliti (18):
  fts: import NetBSD implementation
  fts: drop SCCS specific code
  fts: drop NetBSD headers
  fts: drop __BEGIN_DECLS, BSD-specific headers
  fts: add missing includes
  fts: drop _DIAGASSERT
  fts: drop HAVE_STRUCT_DIRENT_D_NAMLEN
  fts: use realloc instead of reallocarr
  fts: drop CVS tag
  fts: drop aligned statp alloc support
  fts: assume O_CLOEXEC is available
  fts: drop tailing slash compat support
  fts: drop FTS_WHITEOUT support
  fts: drop __FTS_COMPAT_LENGTH
  fts: drop __FTS_COMPAT_LEVEL
  fts: harden fts_alloc with calloc
  fts: backport NULL deref fix from OpenBSD
  fts: backport memory leak fix from FreeBSD

 include/fts.h  |  146 +++++++
 src/misc/fts.c | 1076 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1222 insertions(+)
 create mode 100644 include/fts.h
 create mode 100644 src/misc/fts.c

-- 
2.55.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.