Skip to content

Trouble with some shells like csh #3916

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

Closed
PaulWessel opened this issue Aug 11, 2020 · 4 comments · Fixed by #4758
Closed

Trouble with some shells like csh #3916

PaulWessel opened this issue Aug 11, 2020 · 4 comments · Fixed by #4758
Labels
longterm Long standing issues that need to be resolved

Comments

@PaulWessel
Copy link
Member

It seems that some shells like tcsh and csh will attempt to replace our inset/subset unknown projection width (e.g. -JM?) with a filename via UNIX wildcard expansion, as in this failure . However, unlike bash, zsh, if there is no match then csh will foolishly remove the question mark and GMT fails (as if all text on a commandline is a filename). Users can be told to turn off globbing or escape the question mark with a backslash, but neither are great options.

Looking at my code in gmt_init_module, it should be possible to simply leave off the unknown width without the ? place holder. This is because we have these situations only:

  1. Geographic projection. They all end with the scale or width so we know where to append the actual width
  2. Cartesian -JXwidth or -JXwidth/height. We know if a slash that the height is right after the slash and the width is right after the X.
  3. Polar cylindrical. The scale or width is the first item after -Jp|P, so if that letter is a modifier or NULL then we know where to put it

If we can get away with no specification, then ? can remain a backwards compatible way to do this (and it works fine for sensible shells), but we could move on and simply update the docs accordingly once we find this works.

@seisman
Copy link
Member

seisman commented Aug 11, 2020

However, unlike bash, zsh, if there is no match then csh will foolishly remove the question mark and GMT fails

It's even worse. It fails not because the question mark is removed. When there is no match, the whole command fails without running the gmt command.

@seisman
Copy link
Member

seisman commented Aug 11, 2020

  1. Geographic projection. They all end with the scale or width so we know where to append the actual width

Is it always true? Some projections (for example, -JS) say:

Scale as 1:xxxxx (true scale at pole), slat/1:xxxxx (true scale at standard parallel slat), or radius/latitude where radius is distance on map in plot-units from projection center to a particular oblique latitude (-Js), or simply map width (-JS).

So command like below is allowed:

gmt coast -R-30/30/60/72 -Js0/90/12c/60 -B10g -Dl -A250 -Groyalblue -Sseashell -pdf GMT_stereographic_polar

@PaulWessel
Copy link
Member Author

Right, so that would be -Js0/90//60 and pretty easy to detect. I think we we can pull it off, simply leaving the scale/width completely off, wherever it is, would be simpler for the users than any special character.

@stale
Copy link

stale bot commented Nov 9, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@stale stale bot added the stale This will not be worked on label Nov 9, 2020
@seisman seisman removed the stale This will not be worked on label Nov 9, 2020
@PaulWessel PaulWessel added the longterm Long standing issues that need to be resolved label Jan 25, 2021
@seisman seisman mentioned this issue Feb 6, 2021
PaulWessel added a commit that referenced this issue Feb 6, 2021
Given the issues with csh discussed in #3916, this PR makes the questionmark optional.  It even allows for a lack of final slash.
PaulWessel added a commit that referenced this issue Feb 10, 2021
* Allow the ?-mark for unknow size to be optional

Given the issues with csh discussed in #3916, this PR makes the questionmark optional.  It even allows for a lack of final slash.

* Update gmt_init.c

* Implement the more conservative scheme when ? is not present

Require a trailing / if at least one another argument, or otherwise have no numbers after the projection code.  Adjusted the demonstration inset script and docs. added complement script that tests -JX without ?.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
longterm Long standing issues that need to be resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants