Re: [PATCH]: ls: do not show long iso time format for en_* locales

2009-09-28 Thread Pádraig Brady
Pádraig Brady wrote:
 Jim Meyering wrote:
 The only advantage is that my patch uses the existing framework,
 rather than adding special case code in ls.c proper.
 Whether that is worth the apparent complexity...

 If you prefer his patch and want to adjust it and
 handle the rest, I have no objection.
 
 Yes it's debatable.
 I'll take a closer look at both
 and send an updated one if I think
 the special case in ls.c more appropriate.

Thinking more about this I'm wondering about special casing en_* at all.

The result of this patch is that for most people the usual timestamp
format changes from 1 (ISO) to 3 fields (POSIX).

So the first minor issue I have is that ISO has been the usual
format for 4 years at least, so I suspect that this might trigger
bugs in scripts parsing ls output. I do prefer the traditional
POSIX specified format myself and I'm surprised that no one
reported this until now. In summary I'm about 60:40 for making
the change, and if we do I'll add appropriate text to NEWS.

The other question I have is why do we assume ISO anyway when a
format translation it not available? For example we've no translations
for en_PH or tl_PH and so at the moment they'll get ISO format
even though Tagalog month abbreviations are available:

$ LANG=tl_PH locale abmon
Ene;Peb;Mar;Abr;May;Hun;Hul;Ago;Sep;Okt;Nob;Dis

Now if we do apply the special casing for en_* then you'll have
different date formats for en_PH and tl_PH. Really the date
format is associated with the country rather than the language.
(Note I don't think we can determine whether abmon is specific
to the locale or whether it's just the C default).

So I think if we accept the first point above that we would change the
default format to POSIX for most people I think we should just remove the
code defaulting to ISO if a translation is not available ?

I.E. revert part of 6837183d as follows:

diff --git a/src/ls.c b/src/ls.c
index 1bb6873..4531b94 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2014,7 +2014,6 @@ decode_switches (int argc, char **argv)
 break;

   case long_iso_time_style:
-  case_long_iso_time_style:
 long_time_format[0] = long_time_format[1] = %Y-%m-%d %H:%M;
 break;

@@ -2030,13 +2029,8 @@ decode_switches (int argc, char **argv)
formats.  If not, fall back on long-iso format.  */
 int i;
 for (i = 0; i  2; i++)
-  {
-char const *locale_format =
-  dcgettext (NULL, long_time_format[i], LC_TIME);
-if (locale_format == long_time_format[i])
-  goto case_long_iso_time_style;
-long_time_format[i] = locale_format;
-  }
+  long_time_format[i] =
+dcgettext (NULL, long_time_format[i], LC_TIME);
   }
   }
   /* Note we leave %5b etc. alone so user widths/flags are honored.  */




[PATCH] ls: with -LR, exit with status 2 upon detecting a cycle

2009-09-28 Thread Jim Meyering
Here's a fix to make ls -LR work the same way Solaris 10's /bin/ls
does in the presence of a cycle.

From fb245d0be6231f2962d1481d032b77f3211b29de Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Mon, 28 Sep 2009 18:29:02 +0200
Subject: [PATCH] ls: with -LR, exit with status 2 upon detecting a cycle

* src/ls.c (print_dir): Diagnosing the cycle is not enough.
Also set exit status to 2.  This is what Solaris' /bin/ls does, too.
* tests/ls/infloop: Rework test: match both expected stdout and stderr.
Require an exit status of 2 in this case.
* NEWS (Bug fixes): Mention it.
Reported by Yang Ren in http://bugzilla.redhat.com/525402.
---
 NEWS |2 ++
 src/ls.c |1 +
 tests/ls/infloop |   25 +
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 5060502..d0a9a7d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ GNU coreutils NEWS-*- 
outline -*-
   when the color of a more specific type is disabled.
   [bug introduced in coreutils-5.90]

+  ls -LR exits with status 2, not 0, when it encounters a cycle
+
 ** Portability

   On Solaris 9, many commands would mistakenly treat file/ the same as
diff --git a/src/ls.c b/src/ls.c
index 1bb6873..86f5c32 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2471,6 +2471,7 @@ print_dir (char const *name, char const *realname, bool 
command_line_arg)
   error (0, 0, _(%s: not listing already-listed directory),
  quotearg_colon (name));
   closedir (dirp);
+  set_exit_status (true);
   return;
 }

diff --git a/tests/ls/infloop b/tests/ls/infloop
index 419d7a9..b77f88c 100755
--- a/tests/ls/infloop
+++ b/tests/ls/infloop
@@ -1,7 +1,7 @@
 #!/bin/sh
 # show that the following no longer makes ls infloop
 # mkdir loop; cd loop; ln -s ../loop sub; ls -RL
-
+# Also ensure ls exits with status = 2 in that case.
 # Copyright (C) 2001-2002, 2004, 2006-2009 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
@@ -27,21 +27,22 @@ fi
 mkdir loop || framework_failure
 ln -s ../loop loop/sub || framework_failure

-fail=0
-
-ls -RL loop 2err | head -n 7  out
-# With an inf-looping ls, out will contain these 7 lines:
-cat EOF  bad
+cat \EOF  exp-out || framework_failure
 loop:
 sub
+EOF

-loop/sub:
-sub
-
-loop/sub/sub:
+cat \EOF  exp-err || framework_failure
+ls: loop/sub: not listing already-listed directory
 EOF

-# Make sure we don't get the bad output.
-compare out bad  /dev/null 21  fail=1
+fail=0
+
+timeout 1 ls -RL loop 2err  out
+# Ensure that ls exits with status 2 upon detecting a cycle
+test $? = 2 || fail=1
+
+compare err exp-err || fail=1
+compare out exp-out || fail=1

 Exit $fail
--
1.6.5.rc2.177.ga9dd6




Re: [PATCH] ls: with -LR, exit with status 2 upon detecting a cycle

2009-09-28 Thread Jim Meyering
Jim Meyering wrote:
 Here's a fix to make ls -LR work the same way Solaris 10's /bin/ls
 does in the presence of a cycle.

I've tweaked the patch to udpate the documentation, too.

From 9fad0c69f218a57c9404f7c1137961eec5a818f1 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Mon, 28 Sep 2009 18:29:02 +0200
Subject: [PATCH] ls: with -LR, exit with status 2 upon detecting a cycle

* src/ls.c (print_dir): Diagnosing the cycle is not enough.
Also set exit status to 2.  This is what Solaris' /bin/ls does, too.
* tests/ls/infloop: Rework test: match both expected stdout and stderr.
Require an exit status of 2 in this case.
* doc/coreutils.texi (ls invocation): Mention that a loop provokes
in an exit status of 2.
* NEWS (Bug fixes): Mention it.
Reported by Yang Ren in http://bugzilla.redhat.com/525402.
---
 NEWS   |2 ++
 doc/coreutils.texi |5 +++--
 src/ls.c   |1 +
 tests/ls/infloop   |   25 +
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index 5060502..d0a9a7d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ GNU coreutils NEWS-*- 
outline -*-
   when the color of a more specific type is disabled.
   [bug introduced in coreutils-5.90]

+  ls -LR exits with status 2, not 0, when it encounters a cycle
+
 ** Portability

   On Solaris 9, many commands would mistakenly treat file/ the same as
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index b10cc10..5026e76 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -6113,8 +6113,9 @@ ls invocation
 1 minor problems  (e.g., failure to access a file or directory not
   specified as a command line argument.  This happens when listing a
   directory in which entries are actively being removed or renamed.)
-2 serious trouble (e.g., memory exhausted, invalid option or failure
-  to access file or directory specified as a command line argument)
+2 serious trouble (e.g., memory exhausted, invalid option, failure
+  to access a file or directory specified as a command line argument
+  or a directory loop)
 @end display

 Also see @ref{Common options}.
diff --git a/src/ls.c b/src/ls.c
index 1bb6873..86f5c32 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2471,6 +2471,7 @@ print_dir (char const *name, char const *realname, bool 
command_line_arg)
   error (0, 0, _(%s: not listing already-listed directory),
  quotearg_colon (name));
   closedir (dirp);
+  set_exit_status (true);
   return;
 }

diff --git a/tests/ls/infloop b/tests/ls/infloop
index 419d7a9..b77f88c 100755
--- a/tests/ls/infloop
+++ b/tests/ls/infloop
@@ -1,7 +1,7 @@
 #!/bin/sh
 # show that the following no longer makes ls infloop
 # mkdir loop; cd loop; ln -s ../loop sub; ls -RL
-
+# Also ensure ls exits with status = 2 in that case.
 # Copyright (C) 2001-2002, 2004, 2006-2009 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
@@ -27,21 +27,22 @@ fi
 mkdir loop || framework_failure
 ln -s ../loop loop/sub || framework_failure

-fail=0
-
-ls -RL loop 2err | head -n 7  out
-# With an inf-looping ls, out will contain these 7 lines:
-cat EOF  bad
+cat \EOF  exp-out || framework_failure
 loop:
 sub
+EOF

-loop/sub:
-sub
-
-loop/sub/sub:
+cat \EOF  exp-err || framework_failure
+ls: loop/sub: not listing already-listed directory
 EOF

-# Make sure we don't get the bad output.
-compare out bad  /dev/null 21  fail=1
+fail=0
+
+timeout 1 ls -RL loop 2err  out
+# Ensure that ls exits with status 2 upon detecting a cycle
+test $? = 2 || fail=1
+
+compare err exp-err || fail=1
+compare out exp-out || fail=1

 Exit $fail
--
1.6.5.rc2.177.ga9dd6




[PATCH] ls: print ?, not 0 as inode of dereferenced dangling symlink

2009-09-28 Thread Jim Meyering
Here's another corner-case fix.
I'll push something like this as soon as I've updated NEWS
and added a test.

From 26a1306a0a9028eceed388dad0d8916aeeb00233 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Mon, 28 Sep 2009 20:24:41 +0200
Subject: [PATCH] ls: print ?, not 0 as inode of dereferenced dangling 
symlink

ls prints inode numbers two ways: for long (-l) listings,
and for short ones, e.g., ls -li and ls -i.  The code to print
long listings properly printed ? when the inode was unknown,
but the code for handling short listings would print 0 instead.
Factor out the formatting code into a new function so ls prints
the right string (?) from both places:
* src/ls.c (format_inode): New function.
(print_long_format): Use it here.
(print_file_name_and_frills): Use it here, too.
Reported by Yang Ren in http://bugzilla.redhat.com/525400
---
 src/ls.c |   18 +-
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/ls.c b/src/ls.c
index 86f5c32..c8e8abb 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3556,9 +3556,19 @@ format_group_width (gid_t g)
   return format_user_or_group_width (numeric_ids ? NULL : getgroup (g), g);
 }

+/* Return a pointer to a formatted version of F-stat.st_ino,
+   possibly using buffer, BUF, of length BUFLEN, which must be at least
+   INT_BUFSIZE_BOUND (uintmax_t) bytes.  */
+static char *
+format_inode (char *buf, size_t buflen, const struct fileinfo *f)
+{
+  assert (INT_BUFSIZE_BOUND (uintmax_t) = buflen);
+  return (f-stat.st_ino == NOT_AN_INODE_NUMBER
+  ? (char *) ?
+  : umaxtostr (f-stat.st_ino, buf));
+}

 /* Print information about F in long format.  */
-
 static void
 print_long_format (const struct fileinfo *f)
 {
@@ -3615,9 +3625,7 @@ print_long_format (const struct fileinfo *f)
 {
   char hbuf[INT_BUFSIZE_BOUND (uintmax_t)];
   sprintf (p, %*s , inode_number_width,
-   (f-stat.st_ino == NOT_AN_INODE_NUMBER
-? ?
-: umaxtostr (f-stat.st_ino, hbuf)));
+   format_inode (hbuf, sizeof hbuf, f));
   /* Increment by strlen (p) here, rather than by inode_number_width + 1.
  The latter is wrong when inode_number_width is zero.  */
   p += strlen (p);
@@ -4004,7 +4012,7 @@ print_file_name_and_frills (const struct fileinfo *f, 
size_t start_col)

   if (print_inode)
 printf (%*s , format == with_commas ? 0 : inode_number_width,
-umaxtostr (f-stat.st_ino, buf));
+format_inode (buf, sizeof buf, f));

   if (print_block_size)
 printf (%*s , format == with_commas ? 0 : block_size_width,
--
1.6.5.rc2.177.ga9dd6




Problem with Firefox closing abruptly

2009-09-28 Thread David Weeks
Hello Konsole Guy!

I'm trying to figure out why Firefox 3.14 keeps closing when i click the
links from my music pages.
There is flash and .xml content.

This is my page.
http://david.theweeks.org/music/music.html

This page loads for me, but when I click my Free Album links, Firefox
just closes down.
I'm new to Ubuntu and also can't seem to get other Flash content to
function properly.

Like this Click and Learn.com site.
The Demo won't function.
http://schools.clickandlearn.com/folders.asp?ui

Its just Flash, I can't understand why this is even a problem.

Any help or Browser that loads this content would be great.
I'm on an i386 btw if that has anything to do with my problem.

Thanks?

PS - found your email in the Konsole help area.

Thanks Penguin Gods.
May You forgive my Sindows past.

David Weeks






Re: [PATCH]: ls: do not show long iso time format for en_* locales

2009-09-28 Thread Pádraig Brady
Pádraig Brady wrote:
 Pádraig Brady wrote:
 Jim Meyering wrote:
 The only advantage is that my patch uses the existing framework,
 rather than adding special case code in ls.c proper.
 Whether that is worth the apparent complexity...

 If you prefer his patch and want to adjust it and
 handle the rest, I have no objection.
 Yes it's debatable.
 I'll take a closer look at both
 and send an updated one if I think
 the special case in ls.c more appropriate.
 
 Thinking more about this I'm wondering about special casing en_* at all.
 
 The result of this patch is that for most people the usual timestamp
 format changes from 1 (ISO) to 3 fields (POSIX).

ISO is 2 fields actually :P

 
 So the first minor issue I have is that ISO has been the usual
 format for 4 years at least, so I suspect that this might trigger
 bugs in scripts parsing ls output. I do prefer the traditional
 POSIX specified format myself and I'm surprised that no one
 reported this until now. In summary I'm about 60:40 for making
 the change, and if we do I'll add appropriate text to NEWS.
 
 The other question I have is why do we assume ISO anyway when a
 format translation it not available? For example we've no translations
 for en_PH or tl_PH and so at the moment they'll get ISO format
 even though Tagalog month abbreviations are available:
 
 $ LANG=tl_PH locale abmon
 Ene;Peb;Mar;Abr;May;Hun;Hul;Ago;Sep;Okt;Nob;Dis
 
 Now if we do apply the special casing for en_* then you'll have
 different date formats for en_PH and tl_PH. Really the date
 format is associated with the country rather than the language.
 (Note I don't think we can determine whether abmon is specific
 to the locale or whether it's just the C default).
 
 So I think if we accept the first point above that we would change the
 default format to POSIX for most people I think we should just remove the
 code defaulting to ISO if a translation is not available ?

The full patch is attached.

cheers,
Pádraig.
From 2829fa07edc1ef3f550521b53999dc53c89ff215 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= p...@draigbrady.com
Date: Mon, 28 Sep 2009 17:32:15 +0100
Subject: [PATCH] ls: use the POSIX date style when the locale does not specify one

Previously we defaulted to long-iso format in locales without
specific format translations, like the en_* locales for example.
This reverts part of commit 6837183d, 08-11-2005, ls ... acts like
--time-style='posix-long-iso' if the locale settings are messed up
* src/ls.c (decode_switches): Only use the ISO format when specified.
* NEWS: Mention the change in behavior.
Reported at http://bugzilla.redhat.com/525134
---
 NEWS |5 +
 src/ls.c |   10 ++
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 1571c9c..0380975 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,11 @@ GNU coreutils NEWS-*- outline -*-
   last component (possibly via a dangling symlink) can be created,
   since mkdir will succeed in that case.
 
+  ls -l now uses the traditional three field time style rather than
+  the two field numeric ISO style, in locales where a specific style
+  has not been specified. This currently affects all English language
+  locales for example. [old behavior was introduced in coreutils-6.0]
+
 ** Improvements
 
   rm: rewrite to use gnulib's fts
diff --git a/src/ls.c b/src/ls.c
index 1bb6873..4531b94 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2014,7 +2014,6 @@ decode_switches (int argc, char **argv)
 break;
 
   case long_iso_time_style:
-  case_long_iso_time_style:
 long_time_format[0] = long_time_format[1] = %Y-%m-%d %H:%M;
 break;
 
@@ -2030,13 +2029,8 @@ decode_switches (int argc, char **argv)
formats.  If not, fall back on long-iso format.  */
 int i;
 for (i = 0; i  2; i++)
-  {
-char const *locale_format =
-  dcgettext (NULL, long_time_format[i], LC_TIME);
-if (locale_format == long_time_format[i])
-  goto case_long_iso_time_style;
-long_time_format[i] = locale_format;
-  }
+  long_time_format[i] =
+dcgettext (NULL, long_time_format[i], LC_TIME);
   }
   }
   /* Note we leave %5b etc. alone so user widths/flags are honored.  */
-- 
1.6.2.5



Re: [PATCH]: ls: do not show long iso time format for en_* locales

2009-09-28 Thread Jim Meyering
Pádraig Brady wrote:
 The full patch is attached.
...

That looks fine.  Thanks.
However, I'm a little reluctant to change back.
Let's wait a day or two, in case Paul Eggert has an objection.

Would you please add a test to exercise this,
perhaps based on the one from Ondřej?

From 2829fa07edc1ef3f550521b53999dc53c89ff215 Mon Sep 17 00:00:00 2001
 From: =?utf-8?q?P=C3=A1draig=20Brady?= p...@draigbrady.com
 Date: Mon, 28 Sep 2009 17:32:15 +0100
 Subject: [PATCH] ls: use the POSIX date style when the locale does not 
 specify one
...




Re: [PATCH] ls: print ?, not 0 as inode of dereferenced dangling symlink

2009-09-28 Thread Pádraig Brady
Jim Meyering wrote:
 Here's another corner-case fix.
 I'll push something like this as soon as I've updated NEWS
 and added a test.
 
From 26a1306a0a9028eceed388dad0d8916aeeb00233 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Mon, 28 Sep 2009 20:24:41 +0200
 Subject: [PATCH] ls: print ?, not 0 as inode of dereferenced dangling 
 symlink
 
 ls prints inode numbers two ways: for long (-l) listings,
 and for short ones, e.g., ls -li and ls -i.  The code to print
 long listings properly printed ? when the inode was unknown,
 but the code for handling short listings would print 0 instead.
 Factor out the formatting code into a new function so ls prints
 the right string (?) from both places

looks good.

For my reference I notice the documented `find` behavior is to
fall back to reporting on the dangling symlinks themselves:

$ ls -RLli t/
t/:
ls: cannot access t/bad.link: No such file or directory
total 0
? l? ? ?   ?   ?? bad.link
88141 -rw-rw-r-- 1 padraig padraig 0 2009-09-28 22:10 t
88141 -rw-rw-r-- 1 padraig padraig 0 2009-09-28 22:10 t.link

$ find -L t/ -ls
 846914 drwxrwxr-x   2 padraig  padraig  4096 Sep 28 22:13 t/
 881410 -rw-rw-r--   1 padraig  padraig 0 Sep 28 22:10 t/t
 881410 -rw-rw-r--   1 padraig  padraig 0 Sep 28 22:10 t/t.link
1348260 lrwxrwxrwx   1 padraig  padraig 4 Sep 28 22:04 t/bad.link 
- blah





Re: Problem with Firefox closing abruptly

2009-09-28 Thread Philip Rowlands

On Mon, 28 Sep 2009, David Weeks wrote:


I'm new to Ubuntu and also can't seem to get other Flash content to
function properly.


[snip]


PS - found your email in the Konsole help area.


Bingo.