Fedora Linux Support Community & Resources Center
  #1  
Old 26th September 2011, 10:26 AM
COKEDUDE Offline
Registered User
 
Join Date: Jan 2011
Posts: 353
linuxfirefox
ls flashing red

Can someone please tell me what the flashing red means?

Reply With Quote
  #2  
Old 26th September 2011, 10:30 AM
COKEDUDE Offline
Registered User
 
Join Date: Jan 2011
Posts: 353
linuxfirefox
ln -s accept wildcards?

Does ln -s accept wildcards? It doesn't seem like it is working when I use wildcards.
Reply With Quote
  #3  
Old 26th September 2011, 10:53 AM
leigh123linux
Guest
 
Posts: n/a
linuxredhatfirefox
Re: ln -s accept wildcards?

Threads merged.

answer to post #1 is broken symlinks.
Reply With Quote
  #4  
Old 26th September 2011, 11:07 AM
COKEDUDE Offline
Registered User
 
Join Date: Jan 2011
Posts: 353
linuxfirefox
Re: ln -s accept wildcards?

Quote:
Originally Posted by leigh123linux View Post
Threads merged.

answer to post #1 is broken symlinks.
What about question 2?
Reply With Quote
  #5  
Old 26th September 2011, 01:21 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
Re: ln -s accept wildcards?

It shouldn't, though shell expansion CAN allow it to work.

The problem is that shell expansion may make multiple targets.

IF the result of the expansion is null you get the parameter unexpanded, which then turns into a bad link.

A symbolic link is a file that contains a single pathname, and is marked as a symbolic link in the modes field of the inode.

On some systems, ln would check to see if the target existed before creating the link. If the target did not exist, then the link would not be created.

The GNU ln does not check. This can be both good and bad - Good in that it allows you to create symbolic links to files that will exist. Bad in that it allows typographical errors to become links.

This can be verified:
Code:
$ echo /xyz/*
/xyz/*
$ ls xyz
ls: cannot access xyz: No such file or directory
$ ln -s /xyz/* xyz
$ ls -l xyz
lrwxrwxrwx. 1 zzzz zzzz 6 Sep 26 08:13 xyz -> /xyz/*
$ rm xyz
$ ln -s http://xyz/ xyz
$ ls -l xyz
lrwxrwxrwx. 1 zzz zzz 11 Sep 26 08:17 xyz -> http://xyz/
So some interesting "links" can be created, but currently are not interpreted. Interesting, because it makes it possible to do things like modify "cat" to also provide a basic web retrieval (like curl).
Reply With Quote
  #6  
Old 26th September 2011, 09:35 PM
COKEDUDE Offline
Registered User
 
Join Date: Jan 2011
Posts: 353
linuxfirefox
Re: ln -s accept wildcards?

Quote:
Originally Posted by jpollard View Post
It shouldn't, though shell expansion CAN allow it to work.

The problem is that shell expansion may make multiple targets.

IF the result of the expansion is null you get the parameter unexpanded, which then turns into a bad link.

A symbolic link is a file that contains a single pathname, and is marked as a symbolic link in the modes field of the inode.

On some systems, ln would check to see if the target existed before creating the link. If the target did not exist, then the link would not be created.

The GNU ln does not check. This can be both good and bad - Good in that it allows you to create symbolic links to files that will exist. Bad in that it allows typographical errors to become links.

This can be verified:
Code:
$ echo /xyz/*
/xyz/*
$ ls xyz
ls: cannot access xyz: No such file or directory
$ ln -s /xyz/* xyz
$ ls -l xyz
lrwxrwxrwx. 1 zzzz zzzz 6 Sep 26 08:13 xyz -> /xyz/*
$ rm xyz
$ ln -s http://xyz/ xyz
$ ls -l xyz
lrwxrwxrwx. 1 zzz zzz 11 Sep 26 08:17 xyz -> http://xyz/
So some interesting "links" can be created, but currently are not interpreted. Interesting, because it makes it possible to do things like modify "cat" to also provide a basic web retrieval (like curl).

Is there a problem with this? It didn't work right the first or second time but did the third time.

Code:
#!/bin/bash
echo "Downloading Java"
yum -y install wget
wget http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jre-6u27-linux-i586-rpm.bin
echo "Making executable"
chmod a+x jre*
echo "Installing java"
./jre*
cd /usr/lib/mozilla/plugins
echo "Making symlink so Firefox works"
ln -s /usr/java/jre*/lib/i386/libnpjp2.so
Reply With Quote
  #7  
Old 26th September 2011, 10:52 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
Re: ln -s accept wildcards?

It would work IF and ONLY IF there is only one file that matches "/usr/java/jre*/lib/i386/libnpjp2.so" during the shell expansion.

Suppose there were two versions of jre* - such as jre1 and jre2. The result
would be the command ln -s /usr/java/jre1/lib/i386/libnpjp2.so /usr/java/jre2/lib/i386/libnpjp2.so <whatever target you actually have>

Note, the normal result of "ln -s /usr/java/jre*/lib/i386/libnpjp2.so" as a command will be an error if there is only one file - ln requires two parameters, the first is the file being pointed to, the second is the name used to hold the path.

The way you have it shown it will fail. Exactly why it worked the THIRD time I don't know, unless you DO have two jre* directories.

You may have some bogus links now.
Reply With Quote
  #8  
Old 26th September 2011, 11:53 PM
COKEDUDE Offline
Registered User
 
Join Date: Jan 2011
Posts: 353
linuxfirefox
Re: ln -s accept wildcards?

Quote:
Originally Posted by jpollard View Post
It would work IF and ONLY IF there is only one file that matches "/usr/java/jre*/lib/i386/libnpjp2.so" during the shell expansion.

Suppose there were two versions of jre* - such as jre1 and jre2. The result
would be the command ln -s /usr/java/jre1/lib/i386/libnpjp2.so /usr/java/jre2/lib/i386/libnpjp2.so <whatever target you actually have>

Note, the normal result of "ln -s /usr/java/jre*/lib/i386/libnpjp2.so" as a command will be an error if there is only one file - ln requires two parameters, the first is the file being pointed to, the second is the name used to hold the path.

The way you have it shown it will fail. Exactly why it worked the THIRD time I don't know, unless you DO have two jre* directories.

You may have some bogus links now.
Here's whats in my directory.

Code:
 ls -l /usr/java/
total 4
lrwxrwxrwx. 1 root root   16 Sep 26 05:02 default -> /usr/java/latest
drwxr-xr-x. 7 root root 4096 Sep 26 05:02 jre1.6.0_27
lrwxrwxrwx. 1 root root   21 Sep 26 05:02 latest -> /usr/java/jre1.6.0_27
Reply With Quote
  #9  
Old 27th September 2011, 12:38 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
Re: ln -s accept wildcards?

I think you left off the second parameter from the sample script you showed - the word "default" or "latest".

The only reason it would work is that there is only ONE jrel* reference - jrel1.6.0_27.
Reply With Quote
  #10  
Old 27th September 2011, 01:41 AM
stevea
Guest
 
Posts: n/a
linuxfedorafirefox
Re: ln -s accept wildcards?

Quote:
Originally Posted by jpollard View Post
It shouldn't, though shell expansion CAN allow it to work.
Yes it should - POSIX says that
ln [OPTIONS] src1 src1 src3 target-dir
should create link for each src path within that directory - so long as the last term expands to a real directory.
The problem is that the OP doesn't realize the behavior (I think).
Of course 'ln' doesn't handle wildcards directly, but very few utilities do; that's typically the shell's job.


Quote:
On some systems, ln would check to see if the target existed before creating the link. If the target did not exist, then the link would not be created.

The GNU ln does not check. This can be both good and bad - Good in that it allows you to create symbolic links to files that will exist. Bad in that it allows typographical errors to become links.
That behavior is defined by POSIX; "ln -s left right" or "ln -s lsrc1 lsrc2 lsrc3 rdir" should not check nor care if the left-half file exists when creating a symlink. It's not some GNU-ism and it is important behavior.
http://www.unix.com/man-page/posix/1posix/ln/
Not only is having a link without a real destination valid, and POSIX-ly acceptable - but it's completely unavoidable since the "real" file or parts of it's path may be renamed or unlinked.


Quote:
The problem is that shell expansion may make multiple targets.
If by "problem" you mean expected and useful behavior - then I agree.

Quote:
IF the result of the expansion is null you get the parameter unexpanded, which then turns into a bad link.
I *think* you are trying to say this ...
Code:
[stevea@luchs Desktop]$ mkdir /tmp/test
[stevea@luchs Desktop]$ cd /tmp/test
[stevea@luchs test]$ ln -s ./foo* ./bar*
[stevea@luchs test]$ ls -l 
total 0
lrwxrwxrwx 1 stevea stevea 6 Sep 26 20:24 bar* -> ./foo*
which creates a valid link despite the fact that foo\* doesn't exist.

Then we can do depraved thinks like ....
Code:
[stevea@luchs test]$ touch foo baz
[stevea@luchs test]$ mkdir somedir
[stevea@luchs test]$ ln -s * somedir
[stevea@luchs test]$ ls -l somedir
total 0
lrwxrwxrwx 1 stevea stevea 4 Sep 26 20:31 bar* -> bar*
lrwxrwxrwx 1 stevea stevea 3 Sep 26 20:31 baz -> baz
lrwxrwxrwx 1 stevea stevea 3 Sep 26 20:31 foo -> foo
lrwxrwxrwx 1 stevea stevea 7 Sep 26 20:31 somedir -> somedir

There is nothing BAD about this - so long as we start with a proper understanding that a symlink is a dirent that refers to a PATH that may or may not exist.
Reply With Quote
  #11  
Old 27th September 2011, 03:13 AM
COKEDUDE Offline
Registered User
 
Join Date: Jan 2011
Posts: 353
linuxfirefox
Re: ln -s accept wildcards?

Why doesn't the shell expand this?

Code:
ln -s /usr/java/jre*/lib/i386/libnpjp2.so
Reply With Quote
  #12  
Old 27th September 2011, 09:02 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
Re: ln -s accept wildcards?

If it exists, then it will be expanded. If it doesn't exist it doesn't expand.
Reply With Quote
Reply

Tags
accept, wildcards

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
filename wildcards JILY0 Linux Chat 5 20th June 2010 02:18 PM
LAN diskless boot - MAC wildcards possible ? live11 Servers & Networking 2 10th January 2010 09:22 PM
Using wildcards for subdomains in /etc/hosts? dirkwu Using Fedora 1 28th May 2008 09:12 AM
cp command with wildcards pshepherd Using Fedora 6 3rd January 2007 10:23 AM
Using Wildcards with Yum - Can Ya? Can I? chris_y2k_r1 Using Fedora 8 13th March 2006 03:39 AM


Current GMT-time: 23:49 (Saturday, 23-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat