Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 6.27 KB

gnulib_README.md

File metadata and controls

17 lines (14 loc) · 6.27 KB

gnulib

This is the largest concentration of changes as the fixes here can fix a whole host of issues across multiple tools. For gnulib have separate branches for each category of fixes.

Original Source

  • Symbolic links - Proper implementation of native windows symbolic linking for both files an directories. Implementation of lstat for windows and proper readlink ability. Note S_ISDIR returns true in windows for symbolic link directories, this matches the windows stat / symlink behavior (which treats them differently). There is a new S_ISHARDDIR which tests if it is a directory that is not a symbolic link. The alternative would require intruding a new flag just for directory symbolic links. It is important if having alternate behavior for symlinks you test for that before testing if something is a directory in a decision tree.
  • Windows Paths - Windows supports both '/' and '' (or a mix of them) for path separators. Largely expands the checks for path chars to account for both. Also centralizes all the checks into the existing "filename.h". This also better handles slashes at the end of paths. While windows doesn't support this with most calls things like autocomplete may insert the end slash. This properly handles that and replicates the linux functionality for symbolic links (with the trailing slash treated as a directory vs without treated as the symbolic link itself). It fixes an issue where trying to delete paths that had the windows readonly flag would fail. This adds a implementation of strrpbrk (needed for efficient implementation of find last slash in path).
  • fsusage / volume stat support - Ability to get usage/stats of drive volumes on windows. Adds a few additional stat params including fsu_namemax for the max path length, fsu_fs_type for the type of the filesystem (coreutils requires such info), fsu_fsid for the volume's identifier. Fixes things like du/df working.
  • spawn/pipe/exec/fork fd inheritance - GNULIB platform agnostic spawn lib has Windows default for processes is for handles to inherit like linux, however supporting close on fork (addclose) is tricky. If it already has the inherit flag in Windows these handles would always be inherited even if posix_spawn_file_actions_addclose is called on it. We don't want to alter the caller's flags silently to work around this so we fatally die now if addclose is called with a handle that won't close by default. Finally it makes pipes/sockets by default open with the no inherit flag to make sure forking works properly. This is the recommended method by microsoft. Without this you are likely to experience deadlock/lack of signaling on pipes/sockets shared with children when forking. If is likely possible to call _get_osfhandle to get a windows HANDLE then call SetHandleInformation with HANDLE_FLAG_INHERIT set to 0. Once done revert this but could lead to race conditions and other issues so best to leave to the calling app.
  • NO-OP permission calls - Most permission/ user/group calls are quite different on Windows vs *nix. There is not a one to one conversion as well so most of these calls just return for Windows. We do return the actual username for the user for any uid calls and the generic "Users" group for any group calls. Note a hard code in the idcache module to always return our user created a dependency on the getlogin module (which requires uninstd module). This is somewhat heavy, alternatives would be either making the windows API call directly or using the env var "USERNAME" in Windows.
  • gnulib-tool - Apply patches by filename rather than stdin, ignore whitespace issues (ie for different git checkouts) and no longer apply silently for better debugging.
  • Minor FTS compile fix for windows
  • minor sysstat timespec fix - gnulib polyfiller has an issue in Windows where it wouldn't be declared even when trying to define the replacement.
  • build-aux improvements - For these wrappers around the compiler (ar-lib/compile) expand the conversion support of flags/libs to search more places and naming defaults with better shared/static lib support. Adds optional color output support as well to the scripts if the proper environmental variables are set. See helpers.sh:setup_build_env the $BLD_CONFIG_LOG_COLOR_HIGHLIGHT for an example. Even when not compiling gnulib based tools we often use these build scripts as they do a great job at handling gcc/g++ to windows compiler conversions. We also added the option to call a 3rd party assembler if AS env var points to an assembler and the source file is a *.s file. This is mainly to support gnutls which assumes only gcc.
  • TEST define for physmem.c rename - physmem.c uses #ifdef DEBUG to determine if it should run test code, this is problematic if you want to define DEBUG but not have it in test mode (which won't compile as part of lib). To fix renamed the define to TEST to match what other files use.
  • poll fixes - gnulib has a poll() polyfill for windows, it seems to have some threading issues, and may return earlier than the timeout even though no data is ready. To avoid breaking existing functionality for the timeout fix you must use poll_retry.