DragonFlyBSD/src d7452fd — contrib/file README.DRAGONFLY, contrib/file/src readelf.c

contrib/file: Fix the DragonFly ABI note version decoding

The ABI note stores __DragonFly_version, which is encoded as
major * 100000 + minor * 100 + rev.  file(1) decoded the minor and bump
fields as major * 100000 + minor * 10000 + bump, so a 6.5.22 binary was
reported as "for DragonFly 6.0.522".

Fix the version decoding, similar to my previous patch to readelf(1) in
commit c0de80f6b41e2add4684d84fa92d7abb0fc9b656.

Before:
% file /usr/bin/file
/usr/bin/file: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /libexec/ld-elf.so.2, for DragonFly 6.0.522, stripped

After:
% file /usr/bin/file
/usr/bin/file: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /libexec/ld-elf.so.2, for DragonFly 6.5.22, stripped
DeltaFile
+3-2contrib/file/README.DRAGONFLY
+2-1contrib/file/src/readelf.c
+5-32 files

DragonFlyBSD/src d1f14a3 — test/testcases/vfs Makefile, test/testcases/vfs/dotdot run.sh dotdot.c

testcases: Add regression tests for open() and openat()

With the previous open(2) fixes, all the tests pass:

vfs/dotdot testcase:
```
--- open() of dot/dotdot ---
ok:   open(.) O_WRONLY|O_CREAT                 Is a directory (21)
ok:   open(.) O_RDWR|O_CREAT                   Is a directory (21)
ok:   open(.) O_RDONLY|O_CREAT                 Is a directory (21)
ok:   open(.) O_WRONLY                         Is a directory (21)
ok:   open(.) O_RDONLY                         OK
ok:   open(.) O_WRONLY|O_TRUNC|O_CREAT         Is a directory (21)
ok:   open(.) O_WRONLY|O_CREAT|O_EXCL          File exists (17)
ok:   open(.) O_RDONLY|O_CREAT|O_EXCL          File exists (17)
ok:   open(.) O_RDONLY|O_CREAT|O_DIRECTORY     Is a directory (21)
ok:   open(..) O_WRONLY|O_CREAT                Is a directory (21)
ok:   open(..) O_RDONLY|O_CREAT                Is a directory (21)
ok:   open(..) O_WRONLY|O_CREAT|O_EXCL         File exists (17)

    [54 lines not shown]
DeltaFile
+232-0test/testcases/vfs/dotdot/dotdot.c
+103-0test/testcases/vfs/openat/openat.c
+33-0test/testcases/vfs/openat/run.sh
+33-0test/testcases/vfs/dotdot/run.sh
+13-0test/testcases/vfs/Makefile
+3-0test/testcases/vfs/openat/Makefile
+417-05 files not shown
+428-011 files

DragonFlyBSD/src 325bdd3 — sys/kern vfs_nlookup.c vfs_vnops.c

open(2): Fix open(O_CREAT) to correctly return EISDIR

* Skip "." and ".." terminating paths in nlookup() for NLC_OPEN, so
  they'll be handled in vn_open() to correctly return EISDIR instead of
  EEXIST.

* Let open("/", O_CREAT) through in nlookup(), so this case can be
  handled in vn_open() to return EISDIR.

* Fix vn_open() to return EISDIR if the target is a directory and is
  opened with O_CREAT or O_RDWR/O_TRUNC.

* Fix vn_open() to handle the mount-point target normally when the
  target already exists, instead of simply return EINVAL.

Bug: https://bugs.dragonflybsd.org/issues/3282
Tested-by: pjdfstest (https://github.com/pjd/pjdfstest)
Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)
DeltaFile
+18-6sys/kern/vfs_vnops.c
+14-4sys/kern/vfs_nlookup.c
+32-102 files

DragonFlyBSD/src e20053b — sys/kern vfs_syscalls.c

rename(2): Fix permission check on cross-parent directory rename

Cross-parent directory rename did not require write permission on the
source directory, although its ".." entry is modified. POSIX requires
EACCES there. UFS already performs this check, but HAMMER2 and tmpfs
don't. Fix the bug by adding a generic check in kern_rename().

To reproduce the bug:
```
$ d=$(mktemp -d)
$ mkdir -p ${d}/p1/dir1 ${d}/p2
$ touch ${d}/p1/dir1/file1
$ chmod 0444 ${d}/p1/dir1
$ mv ${d}/p1/dir1 ${d}/p2
```

Before the fix, the last "mv" command succeeded; after the fix, it would
fail with "Permission denied" (EACCES).


    [2 lines not shown]
DeltaFile
+19-0sys/kern/vfs_syscalls.c
+19-01 files

DragonFlyBSD/src 911533c — sys/kern vfs_vnops.c, sys/vfs/devfs devfs_vnops.c

stat(2): Fix 'st_rdev' to report correct (major, minor) numbers

* Fix vn_stat() to fill 'st_rdev' with makeudev() for character and
  block devices that have a valid device number.
* In addition, fix devfs_vop_getattr() to fill 'va_rmajor' in addition to
  'va_rminor', and fix hammer2_vop_getattr() to fill 'va_rmajor' and
  'va_rminor'.

Before the fix, a manually mknod()-created device would have a 'st_rdev'
of NODEV (i.e., -1), for example:
```
$ ~/mknod /tmp/dev-1-2 1 2
dev: 0x102 (major=1, minor=2)
$ ls -l /tmp/dev-1-2
crw-------  1 root  wheel  255, 0xffff00ff Nov  7 18:34 dev-1-2
$ stat -f '%Z' /tmp/dev-1-2
255,4294902015
```


    [12 lines not shown]
DeltaFile
+12-1sys/kern/vfs_vnops.c
+2-2sys/vfs/hammer2/hammer2_vnops.c
+1-0sys/vfs/devfs/devfs_vnops.c
+15-33 files

DragonFlyBSD/src 1e56f00 — sys/kern vfs_syscalls.c

unlink(2): Fail with EPERM when trying to unlink a directory

As specified by POSIX and documented in the unlink(2) man page,
unlinking a directory fails with EPERM instead of EISDIR.  Fix
kern_unlink() to return EPERM when trying to unlink a directory.

Found-by: pjdfstest (https://github.com/pjd/pjdfstest)
Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)
DeltaFile
+7-1sys/kern/vfs_syscalls.c
+7-11 files

DragonFlyBSD/src 4895257 — sys/platform/pc64/x86_64 support.s

pc64: Fix std_copyinstr() to correctly return ENAMETOOLONG

The too-long branch previously compared the destination pointer (%rsi)
against VM_MAX_USER_ADDRESS instead of the source pointer (%rdi). The
destination is kernel memory, so it would always take the EFAULT path
instead of returning the correct ENAMETOOLONG.

Found-by: pjdfstest (https://github.com/pjd/pjdfstest)
Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)
DeltaFile
+1-1sys/platform/pc64/x86_64/support.s
+1-11 files

DragonFlyBSD/src cf2120e — gnu/usr.bin/cc120/drivers Makefile.inc, gnu/usr.bin/cc120/drivers/c++ Makefile

cc120: Use FLAGS.gcc.o to clean up drivers' Makefiles

The macros defined in CFLAGS are only required by gcc.cc, so define them
in CFLAGS.gcc.o and move to drivers/Makefile.inc, and thus clean up the
makefiles of each driver.

While there, remove the unused "Makefile.cco" include from c++/Makefile.
DeltaFile
+0-5gnu/usr.bin/cc120/drivers/c++/Makefile
+5-0gnu/usr.bin/cc120/drivers/Makefile.inc
+0-4gnu/usr.bin/cc120/drivers/cpp/Makefile
+0-4gnu/usr.bin/cc120/drivers/cc/Makefile
+5-134 files

DragonFlyBSD/src 9c7aa63 — gnu/usr.bin/cc120/backends/programs Makefile, gnu/usr.bin/cc120/backends/programs/lto-dump Makefile

cc120: Build and install the "lto-dump" program
DeltaFile
+33-0gnu/usr.bin/cc120/backends/programs/lto-dump/Makefile
+1-0usr.bin/objformat/objformat.c
+1-0usr.bin/objformat/Makefile
+1-0gnu/usr.bin/cc120/backends/programs/Makefile
+36-04 files

DragonFlyBSD/src 38f4e19 — gnu/usr.bin/cc120 Makefile.inc, gnu/usr.bin/cc120/cc_tools Makefile.inc

cc120: Fix -Wmissing-include-dirs warnings in cc_tools

cc_tools is built *before* support-libs, so some of include dirs for
support-libs can be missing, causing the following warnings:

```
cc1plus: warning: /usr/obj/usr/src/gnu/usr.bin/cc120/cc_tools/libcpp/../../support-libs/libdecnumber: No such file or directory [-Wmissing-include-dirs]
```

Fix the warnings by introducing GCC_NO_INCS to not include all the -I
directories.
DeltaFile
+2-1gnu/usr.bin/cc120/cc_tools/Makefile.inc
+3-0gnu/usr.bin/cc120/Makefile.inc
+1-0gnu/usr.bin/cc120/cc_tools/tools/Makefile
+1-0gnu/usr.bin/cc120/cc_tools/libcpp/Makefile
+7-14 files

DragonFlyBSD/src ec3cf3e — gnu/usr.bin/cc120/cc_tools/libcody Makefile, gnu/usr.bin/cc120/cc_tools/libcpp Makefile

cc120: Clean up a few makefiles a bit
DeltaFile
+3-6gnu/usr.bin/cc120/cc_tools/libiberty/Makefile
+3-5gnu/usr.bin/cc120/support-libs/libiberty_pic/Makefile
+3-5gnu/usr.bin/cc120/cc_tools/libcpp/Makefile
+3-5gnu/usr.bin/cc120/cc_tools/libcody/Makefile
+12-214 files

DragonFlyBSD/src bdbf849 — usr.bin/bmake Makefile

bmake(1): Use FLAGS.main.o to set compiler flags

This is simpler than the previous FLAGS_GROUPS method and avoid a
separate mkdep(1) invocation.
DeltaFile
+1-3usr.bin/bmake/Makefile
+1-31 files

DragonFlyBSD/src 5402c12 — gnu/usr.bin/cc120/drivers Makefile, gnu/usr.bin/cc120/drivers/gcc-ar Makefile

cc120: Add gcc-ar, gcc-nm and gcc-ranlib wrappers for LTO
DeltaFile
+17-0gnu/usr.bin/cc120/drivers/gcc-nm/Makefile
+17-0gnu/usr.bin/cc120/drivers/gcc-ranlib/Makefile
+13-0gnu/usr.bin/cc120/drivers/gcc-ar/Makefile
+3-0usr.bin/objformat/objformat.c
+3-0usr.bin/objformat/Makefile
+3-0gnu/usr.bin/cc120/drivers/Makefile
+56-06 files

DragonFlyBSD/src 8ab0c82 — gnu/usr.bin/cc120 Makefile.inc, gnu/usr.bin/cc120/cc_prep/config dragonfly-native.h

cc120: Extract {PREPROCESSOR,DRIVER}_DEFINES from dragonfly-native.h

Refactor dragonfly-native.h to create {PREPROCESSOR,DRIVER}_DEFINES
make variables for use in libbackend and drivers. These two variables
are also defined in GCC's own makefile.

PREPROCESSOR_DEFINES is only used by cppdefault.cc, and DRIVER_DEFINES
is used by gcc.cc and gcc-ar.cc (so applies to gcc-ar, gcc-nm and
gcc-ranlib LTO wrappers).

The intention is to make some defines in DRIVER_DEFINES available to
gcc-ar.cc, which doesn't include "tm.h" to obtain "dragonfly-native.h".
So this is a required change for the upcoming gcc-{ar,nm,ranlib} LTO
wrappers.
DeltaFile
+48-5gnu/usr.bin/cc120/Makefile.inc
+0-19gnu/usr.bin/cc120/cc_prep/config/dragonfly-native.h
+1-3gnu/usr.bin/cc120/drivers/Makefile.inc
+2-0gnu/usr.bin/cc120/libbackend/Makefile
+51-274 files

DragonFlyBSD/src 2ecc468 — contrib/gcc-12/gcc gcc.cc

contrib/gcc-12: Simplify local changes to gcc/gcc.cc
DeltaFile
+10-10contrib/gcc-12/gcc/gcc.cc
+10-101 files

DragonFlyBSD/src 02ff504 — gnu/usr.bin/cc120 Makefile.inc

cc120: Reorder contents in Makefile.inc to read better
DeltaFile
+52-51gnu/usr.bin/cc120/Makefile.inc
+52-511 files

DragonFlyBSD/src f75b19c — gnu/usr.bin/cc120/cc_prep/config dragonfly-native.h

cc120: Clean up dragonfly-native.h

* Add file-level description.
* Remove unnecessary MD_EXEC_PREFIX and MD_EXEC_PREFIX*, which are
  defaulted to be empty strings by gcc.cc.
* Add comment for STARTFILE_PREFIX_SPEC.
* Set a dummy value for STANDARD_STARTFILE_PREFIX and remove
  STANDARD_STARTFILE_PREFIX_{1,2}, which are unused when
  STARTFILE_PREFIX_SPEC is defined.
DeltaFile
+35-18gnu/usr.bin/cc120/cc_prep/config/dragonfly-native.h
+35-181 files

DragonFlyBSD/src caa1ea7 — contrib/gcc-12/gcc toplev.cc, contrib/gcc-12/gcc/lto lto-dump.cc

Merge branch 'vendor/GCC120'

Merge the lto-dump fix.
DeltaFile
+10-6contrib/gcc-12/gcc/lto/lto-dump.cc
+1-1contrib/gcc-12/gcc/toplev.cc
+11-72 files

DragonFlyBSD/src 230c703 — contrib/gcc-12/gcc toplev.cc, contrib/gcc-12/gcc/lto lto-dump.cc

vendor/GCC120: Backport one lto-dump fix

lto-dump: Do not print output file

Right now the following is printed:

lto-dump
        .file   "<artificial>"
        .ident  "GCC: (GNU) 13.0.0 20220707 (experimental)"
        .section        .note.GNU-stack,"",@progbits

After the patch we print -help and do not emit any assembly output:

lto-dump
Usage: lto-dump [OPTION]... SUB_COMMAND [OPTION]...

LTO dump tool command line options.

  -list [options]           Dump the symbol list.

    [5 lines not shown]
DeltaFile
+10-6contrib/gcc-12/gcc/lto/lto-dump.cc
+1-1contrib/gcc-12/gcc/toplev.cc
+11-72 files

DragonFlyBSD/src b411147 — contrib/gcc-12 README.DRAGONFLY, contrib/gcc-12/gcc gcc-ar.cc

contrib/gcc-12: Patch gcc-ar.cc to find the liblto_plugin.so

We place all the tools and the LTO plugin in a common location:
/usr/libexec/gcc120, so need to patch gcc-ar.cc to search this location,
similar to the patch to gcc.cc.
DeltaFile
+4-0contrib/gcc-12/gcc/gcc-ar.cc
+1-0contrib/gcc-12/README.DRAGONFLY
+5-02 files

DragonFlyBSD/src bbb535f — contrib/gcc-12 README.DELETED

contrib/gcc-12: Update README.DELETED
DeltaFile
+0-2contrib/gcc-12/README.DELETED
+0-21 files

DragonFlyBSD/src a6c33b7 — contrib/gcc-12/gcc gcc-ar.cc, contrib/gcc-12/gcc/doc lto-dump.1

Merge branch 'vendor/GCC120'
DeltaFile
+254-0contrib/gcc-12/gcc/gcc-ar.cc
+235-0contrib/gcc-12/gcc/doc/lto-dump.1
+489-02 files

DragonFlyBSD/src 286cc57 — contrib/gcc-12/gcc gcc-ar.cc, contrib/gcc-12/gcc/doc lto-dump.1

vendor/GCC120: Add back gcc-ar.cc and lto-dump.1

* gcc-ar.cc is required to build gcc-{ar,nm,ranlib} wrappers for LTO
  function.
* lto-dump.1 is the man page for the lto-dump utility to be installed.
DeltaFile
+254-0contrib/gcc-12/gcc/gcc-ar.cc
+235-0contrib/gcc-12/gcc/doc/lto-dump.1
+489-02 files

DragonFlyBSD/src f8abf7e — share/mk sys.mk

sys.mk: Remove obsolete ".PARSEDIR" check

It was added for the legacy make to bmake migration in commit
3da8e88fd44bdb1ff2af162b8fecd7c65d5e533b.
DeltaFile
+1-4share/mk/sys.mk
+1-41 files

DragonFlyBSD/src e0f962d — share/terminfo Makefile

terminfo: Remove unused terminfo.tmp and run_tic.sed from Makefile

* The generated run_tic.sed is empty, so the modified terminfo.tmp is
  identical to the original terminfo.src.
* The generated terminfo.tmp is not actually used by run_tic.sh to build
  the entries.

So remove both to clean up. while there, also remove the unnecessary
NOMAN.
DeltaFile
+4-13share/terminfo/Makefile
+4-131 files

DragonFlyBSD/src 75a7ec4 — share/terminfo Makefile

terminfo: Improve the Makefile for entries installation

* Use FILESGROUPS and related macros from <bsd.files.mk> to install the
  entries, replacing the manual explicit "install" target.
* Use the default SHAREMODE (i.e., 444) instead of the custom 644 mode
  for installed entries.
* Use the more conventional <bsd.prog.mk> instead of <bsd.lib.mk>, as
  used by share/termcap, share/tabset, etc.
DeltaFile
+9-8share/terminfo/Makefile
+9-81 files

DragonFlyBSD/src 9f51799 — share/terminfo Makefile

terminfo: Fix entries compilation to output to ${.OBJDIR}

Fix the ${ticdir} and @TERMINFO@ to point to paths in ${.OBJDIR}, so
that the intermediate outputs and compiled entries are all located in
${.OBJDIR}.

In addition, ignore ${DESTDIR} for `run_tic.sh` so the entries output
directory is unaffected during the buildworld, which sets a DESTDIR.

While there, clean up the `run_tic.sh` target to specify the prereq and
to remove the unnecessary `cat` command.
DeltaFile
+18-21share/terminfo/Makefile
+18-211 files

DragonFlyBSD/src 70d3017 — share/terminfo Makefile entries.awk

terminfo: Auto generate entries list from the source terminfo.src

Replace the hand-crafted entries list in Makefile.entries with an
auto-generated one by an awk script, so that it becomes future-proof.

The auto-generated list contains 2780 entries, adding 160 new entries
over the previous stale list, which contained 2620 entries.  In
particular, the new entries include alacritty, kitty, dvtm, etc.
DeltaFile
+0-2,625share/terminfo/Makefile.entries
+17-0share/terminfo/entries.awk
+2-2share/terminfo/Makefile
+19-2,6273 files

DragonFlyBSD/src 02abe7d — lib/libc/gen Symbol.map, lib/libc/thread Symbol.map

libc: Move thread symbols from gen/Symbol.map to thread/Symbol.map

Commit 28e770f9356419201058747986287acae231f334 merged libthread_xu into
libc, and commit aaef2979773f2bfc0f661b17be90d5e5b82b505b moved the
libthread_xu source to libc/thread.  This commit completes the merge by
moving the thread symbols that implemented in libc/thread from
libc/gen/Symbol.map to libc/thread/Symbol.map, so that the Symbol.map
keeps in sync with the source.
DeltaFile
+299-5lib/libc/thread/Symbol.map
+1-289lib/libc/gen/Symbol.map
+300-2942 files

DragonFlyBSD/src fa3b19c — sys/netinet6 in6_src.c

kernel - Fix in6_pcbsetlport() panic

* An assertion is issued after lport is modulo-incremented but
  before checking to see if the loop has exhausted.

  This can result in a field overflow causing the assertion to
  fail.

* Fix by moving the assertion to the correct place.
DeltaFile
+1-2sys/netinet6/in6_src.c
+1-21 files