One-liner: Decompress file and diff against another file
Dec 8th, 2016 by miki

Below is a handy shell one-liner for comparing the decompressed contents of a compressed file against a plain file. The purpose here is to test whether the compressed file is actually derived from compressing the plain file. This particular example is from a real life situation where log rotation by cron.daily on a Ubuntu server had begun failing. The situation is thought to be the result of an interrupted logrotate execution leaving a compressed (but non-rotated) intermediate file in the file system that prevented further log rotation on subsequent executions.

The command constructs a pipe between two process, specified using the | symbol (vertical line), to send the decompressed contents from gunzip stdout to stdin of the compare tool. The example uses diff as compare tool which is suitable for textual contents. You could use f.x. cmp instead if the contents is binary. Both diff and cmp interprets the file name “-” as meaning that input should be read from stdin.

$ gunzip --stdout /var/log/syslog.1.gz | diff --report-identical-files - /var/log/syslog.1
Files - and /var/log/syslog.1 are identical

The above uses long options for clarity, in a real life situation you would probably be using short options instead. That means -c instead of –stdout and s instead of –report-identical-files.

$ gunzip -c /var/log/syslog.1.gz | diff -s - /var/log/syslog.1
Files - and /var/log/syslog.1 are identical


Principal Vista refund in DK
Jan 17th, 2011 by miki

Nice story in the media (GTrans) (+2 (GTrans), 3, (GTrans)) in Denmark right now, is of a consumer who filed a complaint to The Danish Consumer Agency regarding reimbursement of his OEM Windows license, and won in a principal judgment (warning Google Translate exaggerates the price by some decades, the correct refund is DKK 850 ~ EUR 114 ~ USD 151 ).

He wanted to use his new computer for Linux only, but the store (a supermarket) and the computer manufacturer would only accept a refund for the complete purchase, regardless of the Windows Vista license offer to get a refund for the bundled software.

The consumer agency ruled in favor of the consumer, citing his right for reimbursement as pr. the license agreement, and the Danish consumer law that interprets in favor of the consumer when doubts arise.

This is very good news for the rights of Danish consumers, after we were let down by Poul-Henning Kamp’s recent loss in court (GTrans) about a similar complaint.

Go get those Vista refunds!

But remember for Windows 7, the license reads “you must return the entire system on which the software is installed for a refund or credit”, effectively making any product distributed with Windows 7 a madatory subject to the Microsoft tax.

UPDATE 2011/01/18 20:40:

A followup article at ComputerWorld Denmark (GTrans) states that HP Denmark doesn’t think the ruling will have any “practical effect” on their business. They believe very few consumers are interested in alternative operating systems,  and haven’t seen any demand for it in the market. How a demand can be established without a product,  HP doesn’t have any insights into, as they have never had alternative offerings.

Even though we all know what the OEM license says, an OEM director from Microsoft Denmark cleverly enough states that; “we can not and should not interfere with the wording of return policies, including whether the software can be returned with the PC only“. In the last blow to any logic, the HP response is to; “await a statement from Microsoft, and then implement a solution“.

»  Substance:WordPress   »  Style:Ahren Ahimsa
© 2016 Mikini Services