Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

.DS_Store file causes exception during !include <directory> on Windows #364

Closed
chipbite opened this issue Oct 30, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@chipbite
Copy link

chipbite commented Oct 30, 2023

Description

Hi! This is from a discussion on this topic. Link to attached zip file.

Feel free to open a new issue with the relevant details (e.g. CLI version number, example workspace to reproduce the issue, etc).

Originally posted by @simonbrowndotje in structurizr/cli#136 (reply in thread)


Steps to reproduce

Please find the excellent simplified test folder / DSL workspace structure (workspace.zip) from @okamiraner, here: structurizr/cli#136 (reply in thread). Here is also a direct link to workspace.zip.
Unzip workspace.zip to get the folder structure, and open a shell there.

  1. Run structurizr on the workspace.dsl file, e g structurizr export -w workspace.dsl -f plantuml -o c4export

Expected: Includes are successfully parsed and included
Actual: Exception thrown, see below:

PS C:\temp\structurizr\temp-tests\workspace> structurizr export -w .\workspace.dsl -f plantuml -o c4export
Exporting workspace from .\workspace.dsl
 - loading workspace from DSL
com.structurizr.dsl.StructurizrDslParserException: Input length = 1 at line 3 of C:\temp\structurizr\temp-tests\workspace\.\workspace.dsl: !include model
        at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:912)
        at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:128)
        at com.structurizr.cli.export.ExportCommand.run(ExportCommand.java:131)
        at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:81)
        at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:119)

Screenshot

FYR, the folder structure (of the attached zip file, workspace.zip) is:

.
│   workspace.dsl
│   
├───model
│   │   container.dsl
│   │   person.dsl
│   │   
│   └───softwaresystem
│       │   
│       └───spam
│           │   
│           └───model
│               │   container.dsl
│               │   
│               └───container
│                       core.dsl
│                       
└───views
        landscape.dsl

Code sample

Here is some of the code (contained in the files in workspace.zip), that show how the test/sample workspace is set up, with includes:

workspace.dsl

Here are includes, one for model and one for views folders.

workspace {
	model {
		!include model
	}

	views {
		!include views
	}
}

model/container.dsl

someSystem = softwaresystem "someSystem" {
	web = container "Web"
	mobile = container "Mobile"
}

model/person.dsl

!include softwaresystem/spam/modelb2c = person "B2C"
b2b = person "B2B"
staff = person "Staff"

Configuration

This was tested on windows (10).
Tested on two shells, using windows cmd shell & powershell - w same results.

Structurizr version nrs.

2023-08-11  08:17            32 290 structurizr-cli-1.33.1.jar
2023-08-11  08:17            32 521 structurizr-client-1.26.1.jar
2023-08-11  08:17           176 737 structurizr-core-1.26.1.jar
2023-08-11  08:17           117 330 structurizr-d2-exporter-1.5.2.jar
2023-08-11  08:17           186 028 structurizr-dsl-1.32.0.jar
2023-08-11  08:17            77 601 structurizr-export-1.16.1.jar
2023-08-11  08:17            17 007 structurizr-graphviz-2.2.0.jar
2023-08-11  08:17            23 490 structurizr-import-1.5.0.jar

Severity

Minor

Priority

Medium

Resolution

I have no budget and there's no rush, please fix this for free

More information

Maybe this issue belongs in the DSL project instead. Sorry for that, if so.

@chipbite chipbite added the bug Something isn't working label Oct 30, 2023
@simonbrowndotje
Copy link
Contributor

You're going to need to attach a ZIP file with that full directory structure if you'd like some assistance I'm afraid.

@chipbite
Copy link
Author

chipbite commented Nov 4, 2023

Attached zip file, link

I put the link to the attached zip file on top now for easy access.
Here is the link as well:
https://github.com/structurizr/cli/files/12144612/workspace.zip

Also made some clarifications in the report.

@simonbrowndotje
Copy link
Contributor

This is the error that I get from using the ZIP file at https://github.com/structurizr/cli/files/12144612/workspace.zip

./structurizr.sh export -w ./workspace.dsl -f plantuml -o c4export
Exporting workspace from ./workspace.dsl
 - loading workspace from DSL
com.structurizr.dsl.StructurizrDslParserException: Unexpected tokens (expected: enterprise, group, person, softwareSystem, deploymentEnvironment, element, ->) at line 1 of /Users/simon/Downloads/workspace/./model/softwaresystem/spam/model/container/core.dsl: container core "Core" { at line 6 of /Users/simon/Downloads/workspace/./model/container.dsl: !include softwaresystem/spam/model at line 3 of /Users/simon/Downloads/workspace/./workspace.dsl: !include model
	at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:912)
	at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:128)
	at com.structurizr.cli.export.ExportCommand.run(ExportCommand.java:131)
	at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:81)
	at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:119)

This error is caused by some files being included multiple times, which I don't believe is what you're seeing. I think you're still seeing #308 and perhaps hidden files are treated differently between Windows and Mac (I don't have access to a Windows VM for a few days unfortunately).

@simonbrowndotje simonbrowndotje transferred this issue from structurizr/cli Nov 7, 2023
@simonbrowndotje simonbrowndotje changed the title !include <dir> causes a DSL parser exception .DS_Store file causes exception during !include <directory> on Windows Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants