Results 1 to 8 of 8

Thread: openSUSE 11.3 ls time format

  1. #1
    Join Date
    Aug 2008
    Location
    Maryland
    Posts
    208

    Default openSUSE 11.3 ls time format

    I came across a problem running required security scripts. The script runs the following command to build a list of directories to scan.

    ls -lL / | grep "^d" | egrep -v "tcb$|dev$|proc$|vol$|xfn$|cdrom$|mnt$" |awk '{print "/"$9}'

    I have the following Distros:

    Cent 4 and 5
    openSUSE 11.1 11.3 11.4 12.1

    Only 11.3 is showing a problem with ls. 11.3 is using the iso time format for ls -l, this changes the number of fileds. So the directory name is now field 8 instead of nine. Insead of getting a list of directories I get a bunch of /'s.

    Code:
    Atlas:~ # ls -lL / | grep "^d" | egrep -v "tcb$|dev$|proc$|vol$|xfn$|cdrom$|mnt$" |awk '{print "/"$9}'
    /atlas
    /bin
    /boot
    /.config
    /etc
    /home
    /lib
    /lib64
    /localData
    /media
    /opt
    /root
    /sbin
    /selinux
    /srv
    /sys
    /tmp
    /usr
    /var
    /xenaRaid
    
    Hagar:~ # ls -lL / | grep "^d" | egrep -v "tcb$|dev$|proc$|vol$|xfn$|cdrom$|mnt$" |awk '{print "/"$9}'
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    /
    This causes the script to build a list of files on the system that is 18 times then it should be.

    Using ls -lLd /root to test. I have a script that I can send a remote command to all of my linux computers, the only ones that use the iso time format are the 11.3 computers.

    Atlas openSUSE 11.4
    Code:
    Atlas:~ # ls -lLd /root
    drwx------ 41 root root 4096 Jan 6 10:31 /root
    
    Atlas:~ # alias
    .
    ..
    ...
    alias l='ls -alF'
    alias la='ls -la'
    alias ll='ls -l'
    alias ls='ls $LS_OPTIONS'
    alias ls-l='ls -l'
    ...
    ..
    .
    
    Atlas:~ # echo $LS_OPTIONS
    -A -N --color=tty -T 0
    Hagar openSUSE 11.3
    Code:
    Hagar:~ # ls -lLd /root
    drwx------ 44 root root 4096 2012-01-06 10:31 /root
    
    Hagar:~ # alias
    .
    ..
    ...
    alias l='ls -alF'
    alias la='ls -la'
    alias ll='ls -l'
    alias ls='ls $LS_OPTIONS'
    alias ls-l='ls -l'
    ...
    ..
    .
    
    Hagar:~ # echo $LS_OPTIONS
    -A -N --color=tty -T 0
    As my self I get the same results as Hagar openSUSE 11.3. But when I use konsole with Root profile I get the same result as all other distros.

    Hagar openSUSE 11.3 (konsole --profile Root_Shell)
    Code:
    Hagar:~ # ls -lLd /root
    drwx------ 44 root root 4096 Jan  6 10:31 /root
    
    Hagar:~ # alias
    .
    ..
    ...
    alias l='ls -alF'
    alias la='ls -la'
    alias ll='ls -l'
    alias ls='ls $LS_OPTIONS'
    alias ls-l='ls -l'
    ...
    ..
    .
    
    Hagar:~ # echo $LS_OPTIONS
    -A -N --color=tty -T 0
    I do not see where ls is being told to use the iso time format. Or in the Root_Shell case being told to use the regular format. Does any one know why ls in 11.3 uses the iso time format? Dose anyone else on 11.3 see the same thing?

    Thanks

    Dave W

  2. #2

    Default Re: openSUSE 11.3 ls time format

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Great troubleshooting.

    export LANG=POSIX

    Good luck.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.15 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJPBzkfAAoJEF+XTK08PnB5rKYP/20ZKdxTTBuVMIUhZmz6dpw3
    v97heptCNQ8aVC9tqQAcKa/faHoxekTbBNvDZ7uu+uE9F72+xZxWGoceNNseCXKi
    B0J6JUqqzEmmf1VmjevWiAnWzaJkA2Xvd18yRVEIPdUSqBNg8zkd7VLTRppQ0+Sa
    qCddHdFiF7dceEuXVik85Wl6vUu8KtwMPTLLaPRGEmmkunhuOUYXdMWKAodNNxDf
    WT999y1B42A7GORJc+YJRJRk4vRcO8MyWPqn5GB/bujUyuHzwX33Etke2/4eu0XC
    EIrZ3G+Mju+q8QXD0y22stNCco2W1jwNuhbxhGAIlZdrZjKeDYQDnf9TmnDAqhCX
    KE6iFw6bVPEpRhdb2xVLe+dmQREEm1COJOs1sIKHDM/y6qY0i9nyozWUJg2R2RFW
    l/wCQWszgyU4sfNZrEeHz2D8QCirbyMvpGtZQ9O2l3J8bqzhuMN9erOGZGIJosRV
    /GwGzcJc9+ktCQPSCIcFtHzbEHtqVn7MdNAqk6ifMeDHm9wubuRiX2+OYjx5uEOt
    ADzWl2mXRdzQ5Nxoo1/jjUttP4g7xNoLT06c4JdmreRfExlO6M6aWzVLHYxMcyoU
    i53wMmTWup0PXAryVOB5kdwE4kBvIZGQKW9kmxd2tqyNDcYcsiHYsk8ZcjVdhUeI
    gz30eX65vRXsu2Wqa3ZH
    =4gf1
    -----END PGP SIGNATURE-----

  3. #3
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: openSUSE 11.3 ls time format

    If this is your script you can replace most of the pipeline with:

    find / -maxdepth 1 -mindepth 1 -type d

    and avoid the formatting issues.

  4. #4
    Join Date
    Aug 2008
    Location
    Maryland
    Posts
    208

    Default Re: openSUSE 11.3 ls time format

    The scripts are not mine, they come from DoD. There are a few different ways to fix this. I used ls -lLd and sed. But unless I can get DoD to make the change I need to fix the scripts every time I get a update version. But my question was why is 11.3 doing this? It is different from all other CentOS and openSUSE that I am running here.

    DIRs=`ls -lLd /* | grep "^d" |sed -e 's#.* /#/#'|grep -v dev|grep -v proc|grep -v home|grep -v mnt|grep -v atlas|grep -v raid|grep -v usr0`

  5. #5

    Default Re: openSUSE 11.3 ls time format

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Did you not see my other response?

    Good luck.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.15 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJPCz0OAAoJEF+XTK08PnB5W0QP/3ssNZ6uygGz8Q8akoDYDQTq
    XL/hS7MHDlfaxifsDGlLyAfoHHbuW8g2bDHC7PmxWS97unp5dQL2/SBr22mPnDrT
    4JSbYzGgRpNrmWuQJRE5ajr877ZE20v/tKEZKhNHEnLt8xnNsHPlAxvXE5Frupba
    Ssgy1MCi/cqRaWprm9IXKRtNt/3hTOUcve13NEOfNwr7mGlwBhYsaVrYwpeSgZJN
    BSZjjJW1r0B6J5iH5J0eEGf3+erxN03vQmVIZQ+M7PSu1wW64Od57odb7q/OlNxs
    FBnmI2ThrvOkjJXGC2uAwymtCjXawFNghFB8ayfAaDWrglE4fCbju43MMBech6EL
    hVqSaNDMZdIXamOp0MFbE9VfwiX8Ty8DurAeE2bgCZGbV47srvctXNr7GJx6gqIt
    bYJGaB7vCF5OQnjPDjNyUi58qYw6Ssblh7i8dKxbkgJCeImHYoX1mbgCwE9RRAJ2
    DkzbOUArmSQxUmGp8dYkaVf1cjzov6C2r+ENr/ebwHmsy8VYIHOit4mV0cF8vgZg
    vvY/mLjrsWN0rn8oXailMoD7FTj9e66WZ3RxqPu+BK8ONW2cQco4iC1d5qfuRmuv
    LuXzKL4v4wEWqL+qquxeSrCplij3QKEw4qjduy/jCeMmCYS7EFsj8duxxZN0t0gD
    ix0TUNUK0cTbW448BiYl
    =xElT
    -----END PGP SIGNATURE-----

  6. #6
    Join Date
    Aug 2008
    Location
    Maryland
    Posts
    208

    Default Re: openSUSE 11.3 ls time format

    Yes, export LANG=POSIX fixes the problem. But why is 11.3 different from the other versions. 11.4 and 11.3 centos all have LANG=en_US.UTF-8 as its default. Why was en_US.UTF-8 changed for 11.3?

  7. #7

    Default Re: openSUSE 11.3 ls time format

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    It's probably a per-user setting. Try the following to become root and
    then try it again and I think you'll see it is fixed, even though it's 11.3:

    sudo -i

    or

    su -

    The reason, of course, is that LANG is set to POSIX when you become
    root, but that rules out the distro and rules in the user. If you
    become root without overriding the user's own LANG setting then the
    problem persists:

    su

    Good luck.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.15 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJPC1JQAAoJEF+XTK08PnB5vy8P/iSQiyGUUKurWbAHMQq2+AWQ
    552c5rFTshtprZl1QiqYhDuJUbOVS1lnysOQxKfvJjekjbAT0ENMU4omP541XXSF
    r56cK8En4oRGCiB5hUsUb4pJKrqIWReEBVAE55zULVysWYfqym/mrGJlaNqunuC3
    6ErFwqqe0Q7spv3pjDbZbTNWFsovB5OzRuRIdpkQhtewC3lpuMu3+GEgp7ISxOlr
    FU43o3odiQdjUx3JJQniPEQ4Aha+s+/oJJTOL2ouYvSqmdYGlPmCsw4rgHwrPwka
    jJfSaW4Yul3I+J6cg4I0kduMhluWtKyi/ERaT7WD9eYHJC/FuOVwwXOZ+yXimoCC
    bl2QbwhyRanfGGJj0STiyzqhEMoIvvbobM5bhkcgWiLUcOIYYbqAOKfmo88pDsfG
    n5pGF64345x6ch2z6Il8rgcbv3SHHfXaP9Y38Gu7RBV8TqMX+WoFiT4T+QhNRdNC
    HGOBQoBypzdlxj0QrcQjkL8jWwAeKIzelBFJlBa99QWyf2hXUQ7OHVXRfHE1iq5f
    v1ujEUZMSm8gVTkfxcIC0sKeIbs1NCK4po6J6DITSMh4EXByoJYZafjeRuOkJ2lM
    Lzcrl3WbNSv5KoqcbVogist6MLwCf8/j6UF/ICkMLgRbwhGTmeaz+d6tIwkohG91
    lLWfk8DXBqeHZfQKbp83
    =vS65
    -----END PGP SIGNATURE-----

  8. #8
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: openSUSE 11.3 ls time format

    On 2012-01-09 20:06, dwestf wrote:
    >
    > The scripts are not mine, they come from DoD. There are a few different
    > ways to fix this.


    Yes, report their bug to them. They can not assume the environment, they
    have to set it.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

Posting Permissions

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