The recent change to disallow following symlinks by default conflicts with the expected behavior of .stignore. This adds a new flag which may be passed to OpenFile to skip default symlink-forbidding open flag. --------- Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"math/bits"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -173,8 +174,18 @@ const (
|
||||
OptSync = os.O_SYNC
|
||||
OptTruncate = os.O_TRUNC
|
||||
OptWriteOnly = os.O_WRONLY
|
||||
OptFollow = 1 << (bits.UintSize - 2)
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Ensure OptFollow doesn't clash with any other flag.
|
||||
flags := OptAppend | OptCreate | OptExclusive | OptReadOnly | OptReadWrite | OptSync | OptTruncate | OptWriteOnly
|
||||
flags &= OptFollow
|
||||
if flags != 0 {
|
||||
panic("bug: flag clash")
|
||||
}
|
||||
}
|
||||
|
||||
// SkipDir is used as a return value from WalkFuncs to indicate that
|
||||
// the directory named in the call is to be skipped. It is not returned
|
||||
// as an error by any function.
|
||||
|
||||
Reference in New Issue
Block a user