FedoraForum.org - Fedora Support Forums and Community
Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2011
    Posts
    356

    ls flashing red

    Can someone please tell me what the flashing red means?


  2. #2
    Join Date
    Jan 2011
    Posts
    356

    ln -s accept wildcards?

    Does ln -s accept wildcards? It doesn't seem like it is working when I use wildcards.

  3. #3
    leigh123linux Guest

    Re: ln -s accept wildcards?

    Threads merged.

    answer to post #1 is broken symlinks.

  4. #4
    Join Date
    Jan 2011
    Posts
    356

    Re: ln -s accept wildcards?

    Quote Originally Posted by leigh123linux
    Threads merged.

    answer to post #1 is broken symlinks.
    What about question 2?

  5. #5
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,346

    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).

  6. #6
    Join Date
    Jan 2011
    Posts
    356

    Re: ln -s accept wildcards?

    Quote Originally Posted by jpollard
    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

  7. #7
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,346

    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.

  8. #8
    Join Date
    Jan 2011
    Posts
    356

    Re: ln -s accept wildcards?

    Quote Originally Posted by jpollard
    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

  9. #9
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,346

    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.

  10. #10
    stevea Guest

    Re: ln -s accept wildcards?

    Quote Originally Posted by jpollard
    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.


    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.


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

    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.

  11. #11
    Join Date
    Jan 2011
    Posts
    356

    Re: ln -s accept wildcards?

    Why doesn't the shell expand this?

    Code:
    ln -s /usr/java/jre*/lib/i386/libnpjp2.so

  12. #12
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,346

    Re: ln -s accept wildcards?

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

Similar Threads

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •