Opened 14 years ago

Closed 14 years ago

#28434 closed defect (wontfix)

watch fails with spaces in file name or directory path

Reported by: ac1115@… Owned by: mjhsieh@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc:
Port: watch

Description

the "watch" command fails if there is a space anywhere in the file name or directory path. Putting the file name in quotation marks still fails.

for example, this line will fail.

watch tail ~/Library/Logs/iPhone\ Updater\ Logs\iPhoneUpdater\ 1.log

error is

/Users/username/Library/Logs/iPhone: No such file or directory. 

If i were to sym link the log file to the root of my home folder as a file name without spaces it'll work fine.

ln -s  ~/Library/Logs/iPhone\ Updater\ Logs\iPhoneUpdater\ 1.log ~/iphonelog1.log

watch tail ~/iphonelog1.log

...this will work fine now

Change History (4)

comment:1 Changed 14 years ago by ac1115@…

the first code block with the failed watch line. the '\' between Logs and iPhoneUpdater is actually a '/'

comment:2 Changed 14 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to mjhsieh@…
Priority: HighNormal

Please remember to cc the maintainer. As per the ticket guidelines, the High priority is reserved for the use of MacPorts team members.

comment:3 in reply to:  description Changed 14 years ago by mjhsieh@…

As far as I know, this behavior is consistent with watch(1) in Linux. The rationale behind this was that you only escape the space once, so the command line (now unescaped) managed to be stored in the string of 'watch' buffer, but what 'watch' then did was to run the command with the unescaped filename. That unfortunately fails.

Nonetheless, it can be escaped by adding extra double quotation:

watch "tail ~/Library/Logs/iPad\ Updater\ Logs/iPadUpdater\ 1.log"

If you guys don't mind, I'll ask the admin to close the ticket.

Replying to ac1115@…:

the "watch" command fails if there is a space anywhere in the file name or directory path. Putting the file name in quotation marks still fails. for example, this line will fail.

watch tail ~/Library/Logs/iPhone\ Updater\ Logs\iPhoneUpdater\ 1.log

error is

/Users/username/Library/Logs/iPhone: No such file or directory. 

comment:4 Changed 14 years ago by jmroot (Joshua Root)

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.