Open cueckoo opened 3 years ago
Original reply by @myitcv in https://github.com/cuelang/cue/issues/850#issuecomment-805069233
Hi @juanjoku - thanks for raising your first issue in the CUE project!
Just as an FYI, there are some tips on how to create clean reproducers in https://github.com/cuelang/cue/wiki/Creating-test-or-performance-reproducers. The txtar
format is particularly good when it comes to multi-file repros, as is the case here.
For example, here is my reproducer based on the above:
# Run 1
exec cue import -f -p mypackage ./dir1/dir2
! exists file1.cue
! exists dir1/file2.cue
exists dir1/dir2/file3.cue
# Run 2
exec cue import -f -p mypackage ./dir1/dir2
! exists file1.cue
! exists dir1/file2.cue
exists dir1/dir2/file3.cue
-- cue.mod/module.cue --
module: "mod.com"
-- dir1/dir2/file3.json --
{
"File3": true
}
-- dir1/file2.json --
{
"File2": true
}
-- file1.json --
{
"File1": true
}
What's interesting to note is this requires the -p
flag, because the following "succeeds" (but is generally useless because the .cue
files do not have package clauses):
# Run 1
exec cue import -f ./dir1/dir2
! exists file1.cue
! exists dir1/file2.cue
exists dir1/dir2/file3.cue
# Run 2
exec cue import -f ./dir1/dir2
! exists file1.cue
! exists dir1/file2.cue
exists dir1/dir2/file3.cue
-- cue.mod/module.cue --
module: "mod.com"
-- dir1/dir2/file3.json --
{
"File3": true
}
-- dir1/file2.json --
{
"File2": true
}
-- file1.json --
{
"File1": true
}
So what you have observed is indeed a bug. Confirmed at tip (27d305c2)
Original reply by @juanjoku in https://github.com/cuelang/cue/issues/850#issuecomment-805669121
OK! (thx)
Original reply by @myitcv in https://github.com/cuelang/cue/issues/850#issuecomment-805773755
Note this also failed in v0.2.2
- so we will fix this after the release of v0.3.0
(so as not to delay that any longer)
I think this issue has been resolved, or at least I have not reproduced it with CUE v0.4.3.
Dropping the now meaningless v0.4.x milestone. Marking for the CUE team to verify.
Originally opened by @juanjoku in https://github.com/cuelang/cue/issues/850
What version of CUE are you using (
cue version
)?It can be reproduced with cue-v0.2.2 and cue-v0.3.0beta.7.
Does this issue reproduce with the latest release?
Yes
What did you do?
We have found a strange behavior in the command
cue import
.Suppose this directory structure:
The first time
cue import
is executed, only file3.json is converted:But, if the same command is executed again, file1.json and file2.json are converted !!
The workaround to avoid this behaviour is specify "files" instead of "directory" as source for
cue import
:What did you expect to see?
The same result in both executions (it is not clear to me which is expected)