Skip to content

unix: simplify symlink resolution of /etc/localtime#18

Open
dolmen wants to merge 1 commit into
thlib:mainfrom
dolmen-go:unix-simplify-symlink-resolution
Open

unix: simplify symlink resolution of /etc/localtime#18
dolmen wants to merge 1 commit into
thlib:mainfrom
dolmen-go:unix-simplify-symlink-resolution

Conversation

@dolmen

@dolmen dolmen commented May 20, 2026

Copy link
Copy Markdown
Contributor

Simplify symlink resolution of /etc/localtime: the standard path now just calls filepath.EvalSymlinks, and we do more specific checks only on the error path. This removes at least one redundant call to os.Lstat on the standard path.

The documentation for LocalTZ on non-Windows is also fixed.

Simplify symlink resolution of /etc/localtime: the standard path now
directly calls filepath.EvalSymlinks, and we do more specific checks only on
the error path. This removes at least one redundant call to Lstat on the
standard path.

The documentation for LocalTZ on non-Windows is also fixed.
@dolmen dolmen force-pushed the unix-simplify-symlink-resolution branch from e67d4ec to 25b3c91 Compare May 20, 2026 12:53
@timohuovinen

Copy link
Copy Markdown
Contributor

Could this check be wrong if a parent directory, such as /etc, is itself a symlink? filepath.EvalSymlinks("/etc/localtime") resolves symlinks in any path component, so p != localZoneFile does not necessarily mean that /etc/localtime itself is a symlink.

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.

2 participants