The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux > Ubuntu
.
google unix.com



Ubuntu Ubuntu is a complete desktop Linux operating system, freely available with both community and professional support.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cp output /dev/null results in not a directory stevesmo UNIX for Dummies Questions & Answers 1 05-22-2009 04:20 PM
Printer directed at /dev/null still spools requests Brantley SCO 1 06-12-2008 03:24 PM
Goal-directed event processing iBot Complex Event Processing RSS News 0 03-05-2008 12:00 AM
Removing Null data in output liketheshell Shell Programming and Scripting 2 08-13-2007 05:59 PM
URGENT - setup port and dump all output to /dev/null or a file frustrated1 SUN Solaris 1 04-05-2006 08:36 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-08-2009
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
tar not reading if output directed to /dev/null

I stumbled across a somewhat strange behavior of tar and find no explanation for it: i was testing a DVD for read errors and thought to simply tar the content and direct the output to /dev/null:

Code:
tar -cvf - /my/mountpoint/*ts > /dev/null
This way i expected the system to read the complete content and eventually to report a read error if there is one. To my amazement the command came back immediately without any error. Still i didn't believe it had read anything (save for maybe the directory information) so i directed the output to a real file instead.
Code:
tar -cvf - /my/mountpoint/*ts > /tmp/somefile
This time tar did read the files and subsequently reported the read error i was expecting in one file.

My question is, why didn't it read the files before? Is there something i am missing?

bakunin
  #2 (permalink)  
Old 09-08-2009
thegeek thegeek is offline
Registered User
  
 

Join Date: Apr 2009
Location: /usr/bin/vim
Posts: 453
I too did experimentation, but it displayed all the file names.

Before that why you would want to tar and check the integrity, better you can do by reading all the files !!

Use find command with exec, or use dd command with bs & count to read.
  #3 (permalink)  
Old 09-08-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,175
The parameter after "-f" is the archive filename. A value of "-" when there is no pipeline has no sensible meaning.

Try:

Quote:
tar -cvf /dev/null /my/mountpoint/*ts
  #4 (permalink)  
Old 09-08-2009
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
First off, I'd like to state that i do NOT have a problem. I just want to achieve a better understanding. So you don't need to tell me workarounds, as i have already found one.

Quote:
Originally Posted by thegeek View Post
Before that why you would want to tar and check the integrity, better you can do by reading all the files !!
This is exactly what i was expecting tar to do: read all the files.

Quote:
Originally Posted by methyl View Post
The parameter after "-f" is the archive filename. A value of "-" when there is no pipeline has no sensible meaning
Sorry, but this is simply not true: the dash as a filename is signifying <stdout> and if i use a redirection or a pipeline to manipulate tars output further should make no difference.

In fact (as i have stated in my first post) the command worked the way i wrote it when i used a real file (instead of /dev/null) as output destination. It is this inconsistency - the command reading all the files when a real file is the destination and not working, when the destination is /dev/null - i want to understand.

bakunin
  #5 (permalink)  
Old 09-09-2009
ilikecows's Avatar
ilikecows ilikecows is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 114
Does your OS have the equivalent of truss on Solaris. When a program is run with truss system calls are output to STDERR. If you have something like that running tar with that and then redirecting the output to /dev/null and a regular file might show you why it ends so soon.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0