Skip to content

os: consider syscall.EEXIST in os.IsExist #29295

Description

@bep

Note that I'm not very categorical in my issue title, but this debugging of a subtle Afero file system bug has given me enough gray hairs to at least deserve an issue/discussion.

The program below runs fine on *nix but fails on Windows (it compiles fine):

package main

import (
	"log"
	"os"
	"syscall"
)

func main() {
	if !os.IsExist(syscall.EEXIST) {
		log.Fatal("failed")
	}
}

I assume that syscall.EEXIST will never happen on Windows, and then it should probably also not be defined for Windows. I guess that ship has sailed, but you should then consider to expand os.IsExist on Windows to also include this error. Because there may be other people creating file system abstractions that can be bitten by this.

/cc @spf13

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions