packages: coreutils/coreutils-advcopy.patch - revert, stat() fails on direc...
shadzik
shadzik at pld-linux.org
Thu Jan 28 20:37:12 CET 2010
Author: shadzik Date: Thu Jan 28 19:37:12 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- revert, stat() fails on directories
---- Files affected:
packages/coreutils:
coreutils-advcopy.patch (1.5 -> 1.6)
---- Diffs:
================================================================
Index: packages/coreutils/coreutils-advcopy.patch
diff -u packages/coreutils/coreutils-advcopy.patch:1.5 packages/coreutils/coreutils-advcopy.patch:1.6
--- packages/coreutils/coreutils-advcopy.patch:1.5 Wed Jan 27 14:50:37 2010
+++ packages/coreutils/coreutils-advcopy.patch Thu Jan 28 20:37:06 2010
@@ -1,53 +1,3 @@
-diff -ru coreutils-8.4.orig/man/cp.1 coreutils-8.4/man/cp.1
---- coreutils-8.4.orig/man/cp.1 2010-01-25 16:03:29.606930239 +0100
-+++ coreutils-8.4/man/cp.1 2010-01-27 14:35:07.949133697 +0100
-@@ -1,5 +1,5 @@
- .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
--.TH CP "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
-+.TH CP "1" "January 2010" "GNU coreutils 8.4" "User Commands"
- .SH NAME
- cp \- copy files and directories
- .SH SYNOPSIS
-@@ -38,6 +38,9 @@
- opened, remove it and try again (redundant if
- the \fB\-n\fR option is used)
- .TP
-+\fB\-g\fR, \fB\-\-progress\-bar\fR
-+add progress\-bar
-+.TP
- \fB\-i\fR, \fB\-\-interactive\fR
- prompt before overwrite (overrides a previous \fB\-n\fR
- option)
-diff -ru coreutils-8.4.orig/man/dir.1 coreutils-8.4/man/dir.1
---- coreutils-8.4.orig/man/dir.1 2010-01-25 16:03:29.606930239 +0100
-+++ coreutils-8.4/man/dir.1 2010-01-27 14:08:56.390385866 +0100
-@@ -1,5 +1,5 @@
- .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
--.TH DIR "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
-+.TH DIR "1" "January 2010" "GNU coreutils 8.4" "User Commands"
- .SH NAME
- dir \- list directory contents
- .SH SYNOPSIS
-diff -ru coreutils-8.4.orig/man/ls.1 coreutils-8.4/man/ls.1
---- coreutils-8.4.orig/man/ls.1 2010-01-25 16:03:29.616930463 +0100
-+++ coreutils-8.4/man/ls.1 2010-01-27 14:08:56.520388775 +0100
-@@ -1,5 +1,5 @@
- .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
--.TH LS "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
-+.TH LS "1" "January 2010" "GNU coreutils 8.4" "User Commands"
- .SH NAME
- ls \- list directory contents
- .SH SYNOPSIS
-diff -ru coreutils-8.4.orig/man/vdir.1 coreutils-8.4/man/vdir.1
---- coreutils-8.4.orig/man/vdir.1 2010-01-25 16:03:29.606930239 +0100
-+++ coreutils-8.4/man/vdir.1 2010-01-27 14:08:56.630386834 +0100
-@@ -1,5 +1,5 @@
- .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
--.TH VDIR "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
-+.TH VDIR "1" "January 2010" "GNU coreutils 8.4" "User Commands"
- .SH NAME
- vdir \- list directory contents
- .SH SYNOPSIS
diff -ru coreutils-8.4.orig/src/copy.c coreutils-8.4/src/copy.c
--- coreutils-8.4.orig/src/copy.c 2010-01-25 16:03:29.606930239 +0100
+++ coreutils-8.4/src/copy.c 2010-01-26 15:37:24.544158220 +0100
@@ -306,16 +256,8 @@
#endif
diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
--- coreutils-8.4.orig/src/cp.c 2010-01-25 16:03:29.596930015 +0100
-+++ coreutils-8.4/src/cp.c 2010-01-27 14:35:01.999137610 +0100
-@@ -19,6 +19,7 @@
- #include <config.h>
- #include <stdio.h>
- #include <sys/types.h>
-+#include <sys/stat.h>
- #include <getopt.h>
- #include <selinux/selinux.h>
-
-@@ -139,6 +140,7 @@
++++ coreutils-8.4/src/cp.c 2010-01-26 15:42:02.274161757 +0100
+@@ -139,6 +139,7 @@
{"target-directory", required_argument, NULL, 't'},
{"update", no_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'},
@@ -323,7 +265,7 @@
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
-@@ -176,6 +178,7 @@
+@@ -176,6 +177,7 @@
-f, --force if an existing destination file cannot be\n\
opened, remove it and try again (redundant if\n\
the -n option is used)\n\
@@ -331,7 +273,7 @@
-i, --interactive prompt before overwrite (overrides a previous -n\n\
option)\n\
-H follow command-line symbolic links in SOURCE\n\
-@@ -612,6 +615,40 @@
+@@ -612,6 +614,57 @@
quote (file[n_files - 1]));
}
@@ -355,15 +297,32 @@
+ int j;
+ for (j = 0; j < iFiles; j++)
+ {
-+ struct stat buf;
-+ stat(file[j], &buf);
-+ long blocks = buf.st_blocks/2;
-+
-+ iTotalSize += blocks;
++ /* call du -s for each file */
++ /* create command */
++ char command[1024];
++ sprintf ( command, "du -s \"%s\"", file[j] );
++ /* TODO: replace all quote signs in file[i] */
++
++ FILE *fp;
++ char output[1024];
++
++ /* run command */
++ fp = popen(command, "r");
++ if (fp == NULL || fgets(output, sizeof(output)-1, fp) == NULL) {
++ printf("failed to run du.\n" );
++ }
++ else
++ {
++ /* isolate size */
++ strchr ( output, '\t' )[0] = '\0';
++ iTotalSize += atol ( output );
+
-+ printf ( "Calculating total size... %ld\r", iTotalSize );
++ printf ( "Calculating total size... %d\r", iTotalSize );
+ fflush ( stdout );
++ }
+
++ /* close */
++ pclose(fp);
+ }
+ g_iTotalSize = iTotalSize;
+ /* END progress mod */
@@ -372,7 +331,7 @@
if (target_directory)
{
/* cp file1...filen edir
-@@ -754,6 +791,46 @@
+@@ -754,6 +807,46 @@
ok = copy (source, new_dest, 0, x, &unused, NULL);
}
@@ -419,7 +378,7 @@
return ok;
}
-@@ -785,6 +862,7 @@
+@@ -785,6 +878,7 @@
x->recursive = false;
x->sparse_mode = SPARSE_AUTO;
x->symbolic_link = false;
@@ -427,7 +386,7 @@
x->set_mode = false;
x->mode = 0;
-@@ -923,7 +1001,7 @@
+@@ -923,7 +1017,7 @@
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@@ -436,7 +395,7 @@
long_opts, NULL))
!= -1)
{
-@@ -975,6 +1053,10 @@
+@@ -975,6 +1069,10 @@
x.unlink_dest_after_failed_open = true;
break;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/coreutils/coreutils-advcopy.patch?r1=1.5&r2=1.6&f=u
More information about the pld-cvs-commit
mailing list