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

Using double quotes in hammer causes VMF to become corrupt #60

Closed
Trico-Everfire opened this issue Mar 20, 2021 · 9 comments
Closed

Using double quotes in hammer causes VMF to become corrupt #60

Trico-Everfire opened this issue Mar 20, 2021 · 9 comments
Assignees
Labels
Priority 4: Low Something that can be picked up for the next release, but can be kicked back if need be. Type: Bug This is a problem with something that should be working one way, but isn't. What: Hammer Hammer-specific issues
Projects

Comments

@Trico-Everfire
Copy link

Trico-Everfire commented Mar 20, 2021

Describe the bug

using double quotes (") in the instance params causes the VMF file (when you're inserting the params in the func_instance_parms) to become corrupt upon saving. this is most likely due to VMF's using double quotes to incase strings, and saving them causes hammer to become confused. a fix for this is to replace any double quotes in any hammer entity IO with escape characters like \" or replace them entirely with single quotes (')

To Reproduce

Steps to reproduce the behavior:

  1. Open/create instance map
  2. add func_instance_parms and add anything with the default value including double quotes.
  3. save quit and load. if done correctly this should cause hammer to present a error and then (at least in my case) crash in response.

Expected behavior

The VMF file should become corrupt, the fix for this corruption (at least to me) is to either remove the entity manually or remove/replace the double quotes with something else.

Operating System (Optional: Only if OS Specific)

  • N/A
@TeamSpen210
Copy link

This doesn't have much to do with instance params specifically, it's an issue with the BSP and VMF formats themselves - they don't parse \" escapes at all. Single quotes aren't really substitutable either, except for maybe in displayed text.

@TeamSpen210
Copy link

Curious why this was closed, it could be fixed by adding handling to those areas.

@Gocnak
Copy link
Member

Gocnak commented Mar 20, 2021

I would think a sanitizer for the inputs where it could cause corruption would be nice. Something to warn people that they shouldn't use double quotes maybe?

@FrozenDragon0
Copy link

@Gocnak Keep in mind that this corruption issue is already stated plenty of times in the Valve developer wiki.

@hexaflexahexagon
Copy link
Member

@FrozenDragon0 people who aren't aware of the issue or are and aren't paying attention while mapping can easily accidentally input a double quote and then waste an hour or two debugging a very mysterious crash. either avoiding the crash or at the least shoving an error dialogue in the user's face is much preferred to how source currently handles this.

@Trico-Everfire
Copy link
Author

@FrozenDragon0 people who aren't aware of the issue or are and aren't paying attention while mapping can easily accidentally input a double quote and then waste an hour or two debugging a very mysterious crash. either avoiding the crash or at the least shoving an error dialogue in the user's face is much preferred to how source currently handles this.

it does do this, it shows you a little error prompt, but it's vague, vmf's are text, and it'll tell you what line a error occurred, but:
A: the line it occurs on isn't the line that is the cause of the issue, it's the line that throws an error due to the issue.
B: not everyone has a IDE or even a proper text editor (like notepad++) so people with just notepad won't even know what line they're on.
C: not everyone knows what even causes the issue, it just tells you "something is wrong :(" and never explains what.
it's due to my coding background that i happened to know that """ in coding causes issues.

@RealityAnomaly
Copy link
Member

Reopening as this is something we can at least mitigate.

@RealityAnomaly RealityAnomaly added this to To do in General Mar 22, 2021
@JJL772 JJL772 added What: Hammer Hammer-specific issues Type: Bug This is a problem with something that should be working one way, but isn't. labels Apr 30, 2021
@Gocnak Gocnak moved this from Backlog to Medium in General May 17, 2021
@Gocnak Gocnak moved this from Medium to Backlog in General May 17, 2021
@Gocnak Gocnak added the Priority 4: Low Something that can be picked up for the next release, but can be kicked back if need be. label May 17, 2021
@vrad-exe vrad-exe changed the title Bug: using double quotes in hammer instance params causes VMF to become corrupt Using double quotes in hammer causes VMF to become corrupt Dec 4, 2021
@vrad-exe
Copy link

vrad-exe commented Dec 4, 2021

Could we just fix this properly by adding support for \"?

@ozxybox
Copy link
Member

ozxybox commented Sep 26, 2023

This feature has been implemented and is now live on the staging branch.

@ozxybox ozxybox closed this as completed Sep 26, 2023
General automation moved this from Backlog to Done Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 4: Low Something that can be picked up for the next release, but can be kicked back if need be. Type: Bug This is a problem with something that should be working one way, but isn't. What: Hammer Hammer-specific issues
Projects
General
  
Done
Development

No branches or pull requests

10 participants