Project

General

Profile

Actions

Bug #18896

closed

Shellwords.escape(nil) returns "empty" string

Added by hspem (Per-Erik Martin) over 2 years ago. Updated over 2 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [powerpc-aix7.1.0]
[ruby-core:109142]

Description

Mistakenly calling Shellwords.escape with nil as parameter had this result:

irb(main):002:0> Shellwords.escape(nil)
=> "''"

This is not helpful and resulted a hard-to-find bug when a script proceeded to use an empty string where it shouldn't be possible. nil is not a string and escape should raise an exception instead.
Shellwords version:

# gem list shellwords

*** LOCAL GEMS ***

shellwords (default: 0.1.0)
# 
Actions

Also available in: Atom PDF

Like0
Like0Like0