Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent handling of hidden files #3564

Open
davireis opened this issue Nov 8, 2024 · 0 comments
Open

Inconsistent handling of hidden files #3564

davireis opened this issue Nov 8, 2024 · 0 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@davireis
Copy link

davireis commented Nov 8, 2024

What version of CUE are you using (cue version)?

$ cue version
cue version v0.10.0

go version go1.23.0
      -buildmode exe
       -compiler gc
        -ldflags -s -w -X cuelang.org/go/cmd/cue/cmd.version=v0.10.0
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
         GOARM64 v8.0
             vcs git
    vcs.revision a7c37ee1eeb84546552bcc70aa280ab7c748e9e9
        vcs.time 2024-08-14T21:53:19Z
    vcs.modified false
cue.lang.version v0.10.0

Does this issue reproduce with the latest stable release?

Yes.

What did you do?

echo -e "package p\na: 1" > file.cue
echo -e "package p\nb: 2" > .hidden.cue
echo -e "package p\nc: 3" > .cue

cue export .
{
    "a": 1
}

cue export file.cue .hidden.cue .cue
{
    "c": 3,
    "b": 2,
    "a": 1
}

cue export .cue
cannot determine package name for ".cue"; set it explicitly with ':'
cannot find package ".cue": cannot find module providing package .cue

What did you expect to see?

The first two commands should yield the same result, and the third one should not fail.

What did you see instead?

The first command should yield the same result as the second. That means that explicitly specifying all the files in the same package should lead to the same result as specifying the directory. However, files that start with a dot are ignored if not added explicitly. Besides being surprising due to the fact that the dot files have a package specified, this breaks an interesting idioms of naming cue files after the files they validate, and those are often configs that start with a dot, like .pkgx.yaml.

Also, for the file named .cue the command fails to infer its package, even though it works just fine if specified together with other files.

@davireis davireis added NeedsInvestigation Triage Requires triage/attention labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant