Operating System - HP-UX
1823251 Members
3247 Online
109648 Solutions
New Discussion юеВ

Fail to create depot with whitespace in file names

 
SOLVED
Go to solution
Jianbo Li
Occasional Advisor

Fail to create depot with whitespace in file names

Dear all,

I'm trying to create a depot with swpackage and some of the files to be delivered contain whitespace in filenames. I created below psf:

directory /tmp/tc_output2.2/HPUX11.0/prepackage/proot/SpaceInFileName=/
file -m 555 -o bin -g bin opt/OV/bin/file Space In Name

The file I tried to deliver is "file Space In Name" but swpackage reported an error and said 'opt/OV/bin/file' couldn't be found.

I also tried double-quote surrounding file name but swpackage reported error again.

Is there anybody know how to package a file with space in its name? Any help is appreciated!

Thank you in advance!
Jianbo
15 REPLIES 15
Avinash20
Honored Contributor

Re: Fail to create depot with whitespace in file names

http://docs.hp.com/en/B2355-90682/swpackage.4.html

keyword value

Use double quotes (") to define values that span multiple lines:

"This is an example of a

two-line value."

#

Double quotes (") are optional when defining a value that contains embedded whitespace.

### Also check that nsswitch.conf contains

hosts: files dns

## /etc/hosts contains the correct hostname to IP address mapping and nslookup works fine.

# swagentd -r

>> Then again try to install
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Jianbo Li
Occasional Advisor

Re: Fail to create depot with whitespace in file names

Thank you for your reply!

I tried:
directory /tmp/tc_output2.2/HPUX11.0/prepackage/proot/SpaceInFileName=/
file -m 555 -o bin -g bin "opt/OV/bin/file Space In Name"

Got below errors:
ERROR: Invalid definition for the file "Space", beginning at line 41.
Valid file definitions are of the form:

file [-t type] [-m mode | -u umask] [-o [owner[,]][uid]] \
[-g [group[,]][gid]] [-v] source [dest]

Seems that it ignored double quote and considered the " Space" as optional [dest] value
Avinash20
Honored Contributor

Re: Fail to create depot with whitespace in file names

opt/OV/bin/"file Space In Name"

Please try like above
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Avinash20
Honored Contributor

Re: Fail to create depot with whitespace in file names

Also please remember to assign points to the threads once you get your answers
http://forums11.itrc.hp.com/service/forums/helptips.do?#33
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Jianbo Li
Occasional Advisor

Re: Fail to create depot with whitespace in file names

Thanks. I will if I get the answer.

I have tried this before but didn't help. It reported the same error.
Dennis Handly
Acclaimed Contributor
Solution

Re: Fail to create depot with whitespace in file names

>I'm trying to create a depot with swpackage and some of the files to be delivered contain whitespace in filenames.

Don't. Unix Shells and shell users hate these files. Using a "_" would be a good compromise.
OldSchool
Honored Contributor

Re: Fail to create depot with whitespace in file names

"...delivered contain whitespace in filenames...."

don't do that. UNIX isn't Windoozz. For this to work, everything in "swpackage" would have to be written to handle whitespace in names. As you've seen, it probably doesn't, or at least not well.

as noted above, rename to something more fitting for UNIX, say "_".
Dennis Handly
Acclaimed Contributor

Re: Fail to create depot with whitespace in file names

>OldSchool: For this to work, everything in swpackage would have to be written to handle whitespace in names.

Besides swpackage, all of SD, including the IPD files.
T G Manikandan
Honored Contributor

Re: Fail to create depot with whitespace in file names

Can you try

/opt/OV/bin/file\ Space\ In\ Name
Jianbo Li
Occasional Advisor

Re: Fail to create depot with whitespace in file names

I tried \ as well. It didn't work.

Thanks Dennis and Oldschool, I think replace whitespace with _ would be a good choice.
Jianbo Li
Occasional Advisor

Re: Fail to create depot with whitespace in file names

I'm just a little bit confused. Why HPUX support whitespace in directory and file names but swpackage doesn't support it?

Meanwhile, I tried * to cover all files in the parent directory. Those files with spaces in names had also been packaged successfully. However, this didn't meet my needs, because I want to set permission/ownership for each file.
James R. Ferguson
Acclaimed Contributor

Re: Fail to create depot with whitespace in file names

Hi Jianbo:

> I'm just a little bit confused. Why HPUX support whitespace in directory and file names but swpackage doesn't support it?

It's really a matter of parsing a line into component fields that matters. By default, the interfield-seperator ('IFS' of the shell environment) is a space, a tab, and/or a newline. The IFS separates words resulting from command or parameter substitution or a read(). It's quite legal to change the default IFS in a script, but this isn't generally needed. Perhaps one of the best examples of changing the IFS is when you want to parse the '/etc/passwd' file in a shell script. In that case, you set the IFS to a colon (":") such that each line read is automatically split into fields delimited by the colon.

Hence, a space character in a file name is quite legal, though generally cumbersome to deal with. You might liken the use there to the arbitrary addition of spaces among the letters of English words.

Regards!

...JRF...
Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Fail to create depot with whitespace in file names

>Why HP-UX support whitespace in directory and file names but swpackage doesn't support it?

HP-UX supports it because applications may want to use it. Probably SD tools don't support it because the installed files don't really need it, only what the user creates after it is installed.

>Those files with spaces in names had also been packaged successfully.

You might want to try swverify to see if it knows how to parse the spaces in the IPD.

>this didn't meet my needs, because I want to set permission/ownership for each file.

You can solve that by changing the ownership/permissions on the files before you run swpackage. Or if the permissions are the same, you can set up defaults.
Jianbo Li
Occasional Advisor

Re: Fail to create depot with whitespace in file names

Thank you all! I got the answer!
Jianbo Li
Occasional Advisor

Re: Fail to create depot with whitespace in file names

Thanks.