View Issue Details

IDProjectCategoryView StatusLast Update
0000088tcsh[All Projects] Generalpublic2019-06-27 01:18
ReportersharifibAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version6.21.00 
Target VersionFixed in Version 
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

Issue History

Date Modified Username Field Change
2019-06-27 01:14 sharifib New Issue
2019-06-27 01:18 sharifib Note Added: 0003256