Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 667150 Details for
Bug 579251
less fails to decompress empty files that have been gzipped
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch extracted from the upstream package
less-444-empty-lessopen.patch (text/plain), 2.50 KB, created by
Martin Bříza
on 2012-12-21 09:57:25 UTC
(
hide
)
Description:
Patch extracted from the upstream package
Filename:
MIME Type:
Creator:
Martin Bříza
Created:
2012-12-21 09:57:25 UTC
Size:
2.50 KB
patch
obsolete
>diff -rup less-444/filename.c less-444-modified/filename.c >--- less-444/filename.c 2011-04-12 00:04:22.000000000 +0200 >+++ less-444-modified/filename.c 2012-06-13 15:42:44.870795863 +0200 >@@ -844,6 +844,16 @@ open_altfile(filename, pf, pfd) > #else > lessopen++; > returnfd = 1; >+ >+ if (*lessopen == '|') { >+ /* >+ * If there is another vertical bar |, after >+ * the first one, it indicates a "pipe preprocessor" >+ * with correct exit status. >+ */ >+ lessopen++; >+ returnfd = 2; >+ } > #endif > } > if (*lessopen == '-') { >@@ -880,17 +890,39 @@ open_altfile(filename, pf, pfd) > */ > f = fileno(fd); > SET_BINARY(f); >+ *pfd = (void *) fd; >+ *pf = f; > if (read(f, &c, 1) != 1) > { > /* >- * Pipe is empty. This means there is no alt file. >+ * Error or pipe is empty. Close it and eventually >+ * check exit status of the pipe process. > */ >- pclose(fd); >+ *pf = 0; >+ *pfd = NULL; >+ if (pclose(fd) == 0 && returnfd == 2) { >+ /* >+ * Exit status was zero, so the EOF was correct empty output. >+ * Let the program open the archive again and seek to its end to >+ * be sure to get EOF. >+ * Quite ugly hack, to provide platform independency >+ */ >+ fd = fopen(filename, "rb"); >+ if (fd == NULL) >+ return (NULL); >+ int check_seek = fseek(fd, 0, SEEK_END); >+ if (check_seek != 0) >+ { >+ fclose(fd); >+ return (NULL); >+ } >+ *pf = fileno(fd); >+ *pfd = (void *) fd; >+ return (save(filename)); >+ } > return (NULL); > } > ch_ungetchar(c); >- *pfd = (void *) fd; >- *pf = f; > return (save("-")); > } > #endif >diff -rup less-444/less.nro less-444-modified/less.nro >--- less-444/less.nro 2011-06-09 19:19:50.000000000 +0200 >+++ less-444-modified/less.nro 2012-06-13 15:19:09.692815223 +0200 >@@ -1160,11 +1160,26 @@ lesspipe.sh: > .br > ;; > .br >+ *) exit 1 >+.br >+ ;; >+.br > esac > .br >+ exit $? >+.br > .PP > To use this script, put it where it can be executed and set > LESSOPEN="|lesspipe.sh %s". >+.PP >+The script should return zero if the output was valid and non-zero >+otherwise, so less could detect even a valid empty output >+(for example while uncompressing gzipped empty file). >+For backward-compatibility, this is not required by default. To turn >+this functionality there should be another vertical bar (|) straight >+after the first one in the LESSOPEN environment variable, eg. >+LESSOPEN="||lesspipe.sh %s". >+.PP > When an input pipe is used, a LESSCLOSE postprocessor can be used, > but it is usually not necessary since there is no replacement file > to clean up.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 579251
:
432385
| 667150 |
667151