View Issue Details

IDProjectCategoryView StatusLast Update
0000088tcsh[All Projects] Generalpublic2019-08-01 16:05
ReportersharifibAssigned Tochristos 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version6.21.00 
Target VersionFixed in VersionHEAD 
Summary0000088: :q does not preserve empty strings
DescriptionThe :q modifier appears to skip empty strings. This makes it very difficult to pass verbatim arguments to another program.
Steps To ReproduceMinimal example:
> echo $tcsh
6.21.00
> set arr= ( '1st arg' '' '3rd arg' )
> echo ${#arr}
3
> tcsh -c 'echo ${#argv}' $arr:q
2
> tcsh -c 'echo ${#argv}' '1st arg' '' '3rd arg'
3

Expected result:
3
3
3
Additional InformationThis is not new behavior, but complicates writing scripts that want to maintain and pass a variable number of arguments to other programs, some of which could possibly be empty. For example, something like the env command which may consume some initial arguments but does an exec with the remaining verbatim arguments. In tcsh, attempting to do the same with exec $argv[2-]:q apparently doesn't preserve any of the empty arguments.
TagsNo tags attached.

Activities

sharifib

2019-06-27 01:18

reporter   ~0003256

Another example:
> set arr= ( '1st arg' '' '3rd arg' )
> set arr2= ( $arr:q )
> echo ${#arr}
3
> echo ${#arr2}
2

Expected result:
3
3

christos

2019-08-01 16:05

manager   ~0003276

Fixed, thanks!

Issue History

Date Modified Username Field Change
2019-06-27 01:14 sharifib New Issue
2019-06-27 01:18 sharifib Note Added: 0003256
2019-08-01 16:05 christos Assigned To => christos
2019-08-01 16:05 christos Status new => assigned
2019-08-01 16:05 christos Status assigned => resolved
2019-08-01 16:05 christos Resolution open => fixed
2019-08-01 16:05 christos Fixed in Version => HEAD
2019-08-01 16:05 christos Note Added: 0003276