Skip to content

Conversation

@jepler
Copy link

@jepler jepler commented Aug 18, 2025

It is not possible to build hfsutils on gcc 14.1, which "enforces strict cv-qualifier check by default."

This PR incorporates:

  • the const fixes patch from Zixing Liu
  • two additional alloc/free mismatches, one from Zixing Liu and one from me
  • additional changes for (non-fatal) diagnostics in os.c related to casting between int and ptr
  • In tclhfs and hfswish, get rid of deprecated use of interp->result

Zixing Liu and others added 5 commits August 18, 2025 08:38
The allocation on line 1032 is created via Tcl_SplitList,
and so it must be freed with Tcl_Free rather than bare free.
```
1032           if (Tcl_SplitList(interp, argv[2], &listc, &listv) != TCL_OK)
```

This change is adapted from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075067
GCC 14 now enforces strict cv-qualifier check by default.
This patch fixes all the cv-qualifier violations.

This change is adapted from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075067
fargv is allocated by hfs_glob so it must be freed by free, not Tcl_Free.

```
1036           fargv = hfs_glob(vol, listc, listv, &fargc);
```
A Unix file descriptor number is stored in the
"generic callback argument" `void **priv`. However, on LP64
systems like x86_64 linux, `int` and `void **` have different size.
This leads to a compiler diagnostic:
```
os.c: In function ‘os_write’:
os.c:192:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  192 |   int fd = (int) *priv;
      |            ^
```
Adding an additional cast via `intptr_t` resolves the compiler
diagnostics.
Direct access to interp->result has been deprecated for a long
time. Fix it.

 * Where the result is being read, use Tcl_GetStringResult
 * Where the result is being written, use Tcl_SetResult
   * Where it is being written from a printf format string, use
     a wrapper function "resultf".
   * In each case, ensure the correct free function is
     passed (static, dynamic, or volatile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant