Skip to content

cmd/cue: hidden files affect the loader's choice of package to evaluate #3795

@jpluscplusm

Description

@jpluscplusm

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

$ cue version
cue version v0.13.0-0.dev.0.20250306134408-5d2da079a295

go version go1.24.0
      -buildmode exe
       -compiler gc
  DefaultGODEBUG gotestjsonbuildtext=1,multipathtcp=0,randseednop=0,rsa1024min=0,tlsmlkem=0,x509rsacrt=0,x509usepolicies=0
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.13.0

Does this issue reproduce with the latest stable release?

Yes, v0.12.0.

What did you do?

# file & hidden file with same package identifier and conflicting data.
cd $WORK/A
exec cue export
cmp stdout $WORK/A.gold

# file & hidden file with different package identifiers.
cd $WORK/B
exec cue export
cmp stdout $WORK/B.gold

-- A/.foo.cue --
package A
x: 1
-- A/file.cue --
package A
x: 2
-- B/.foo.cue --
package foo
x: 3
-- B/file.cue --
package B
x: 3
-- A.gold --
{
    "x": 2
}
-- B.gold --
{
    "x": 3
}

What did you expect to see?

A passing test, indicating that hidden CUE files (with filenames that start with a period) are ignored -- as is demonstrated in the first test where a hidden CUE file contains data that conflicts with data in a non-hidden CUE file.

What did you see instead?

# file & hidden file with same package identifier and conflicting data. (0.019s)
# file & hidden file with different package identifiers. (0.017s)
> cd $WORK/B
$WORK/B
> exec cue export
[stderr]
found packages "foo" (.foo.cue) and "B" (file.cue) in "."
[exit status 1]
FAIL: excluded-hidden-files-affect-loader.txtar:8: unexpected command failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions