Linux-Misc Digest #980, Volume #24               Wed, 28 Jun 00 21:13:03 EDT

Contents:
  Re: Full System Restore (Robert Heller)
  Re: Using CDRW as tar-like device (Carlos)
  Re: gcc --version (Bob Martin)
  printer problem (Raul Montoliu =?iso-8859-1?Q?Col=E1s?=)
  Images to mpeg... (Craig Jones)
  Re: tool for joining various (text) files, editing and splitting them (Uwe Brauer)
  File locking and file permissions (Bill Cripe)
  Can't compile RTL8139.c; PAGE_OFFSET_RAW error ("news.compuserve.com")
  Re: Images to mpeg... (Dances With Crows)
  Re: Using CDRW as tar-like device (Dances With Crows)
  Re: Need clarification:  what really is 'MBR' and what is 'BOOT SECTOR'? (Rod Smith)
  Re: Need clarification:  what really is 'MBR' and what is 'BOOT SECTOR'? (Rod Smith)
  Re: File locking and file permissions (brian moore)
  @home port scanning (Alex)

----------------------------------------------------------------------------

From: Robert Heller <[EMAIL PROTECTED]>
Subject: Re: Full System Restore
Date: Thu, 29 Jun 2000 00:10:03 GMT

  Brian Helm <[EMAIL PROTECTED]>,
  In a message on Wed, 28 Jun 2000 15:30:12 GMT, wrote :

BH> I am having a problem with the boot floppy that is created when the 
BH> initial installation is performed.  This so-called "boot" floppy does 
BH> nothing more than search for the necessary files/shared libraries off the 
BH> hard drive.  When it tries to find them (and it cannot because of the 
BH> incomplete restore) it hacks up another fur ball and freezes the system.

The boot floppy only has LILO, the kernel and a possible ramdisk -- what
you need to boot, not a root file system.

The boot floppy should let you type 'rescue' at the boot: prompt.  It
will ask for a rescue floppy later in the boot, rather then try to mount
and start the init from the hard disk (which is not possible for you).

BH> 
BH> Also, I cannot find any reference to the creation of the "rescue" floppy.
BH> 
BH> I would love to be able to generate the necessary environment on floppy to 
BH> create the escential utilities enabling me to perform the steps you have 
BH> outlined.  Would you go into more detail as the documentation included 
BH> with Linux-Mandrake is extremely vauge.

On the CD, there should be a directory named 'images' at the top level.
There should be a file named 'rescue.img' in this directory.  This is
an image of a rescue root file system -- copy it to a floppy with dd
(or RAWRITE.EXE). I don't know what is in this disk image -- I don't
know if it has all of the bits and pieces you need.

This assumes that the Mandrake people did not decide to clean out stuff
from the original RedHat CD.  If so, you should be able to download a
rescue floppy image from a RedHat mirror site (see
http://www.redhat.com/mirrors.html for a site).

Visit the 'Rescue Disk' HOWTO under http://www.linuxdoc.org/ for all
sorts of information on creating a custom 'Rescue Disk'.

BH> 
BH> Thank you 
BH> 
BH> Robert Heller wrote:
BH> > 
BH> > 
BH> >   Brian Helm <[EMAIL PROTECTED]>,
BH> >   In a message on Tue, 27 Jun 2000 21:30:03 GMT, wrote :
BH> > 
BH> > BH> I performed a full system backup using 'tar' and backed up every 
BH> thing 
BH> > BH> from '/' on down.  I went to perform a full system restore using the 
BH> same 
BH> > BH> tape and the system totally froze up when attempting to restore 
BH> > BH> the /lib/ld-2.1.2.so and /lib/ld-linux.so.2 files.
BH> > BH> 
BH> > BH> Is there a way to boot and run a kernal that will not utilize any 
BH> > BH> libraries on the hard drive so that I can complete my full system 
BH> restore?
BH> > BH> 
BH> > BH> What happens if a hard drive totally crashes?  Must you first 
BH> install the 
BH> > BH> OS from the CD-ROM and restore selected file systems? 
BH> > BH> 
BH> > BH> Doesn't make any sense.  What is the point of backing up the full 
BH> system 
BH> > BH> then.
BH> > BH> 
BH> > BH> Help!!!!! 
BH> > 
BH> > You can't restore certain files *on a running system*.  Specifically
BH> > stuff line /lib/ld-2.1.2.so and /lib/ld-linux.so.2, as well as various
BH> > other shared libraries.
BH> > 
BH> > Now, it is quite possible to create a 'tiny' Linux system that fits
BH> > entirely on one (or two) floppies.  That is you create a boot and root
BH> > floppy, specifically designed to restore a full backup in the event of
BH> > a total hard drive crash.  The rescue floppy needs to have the modules
BH> > for your tape drive (SCSI conrtoller, sd.o, st.o, or whatever), tar,
BH> > mkswap, mke2fs, and fdisk, and whatever shared libraries they need (or
BH> > better a *staticly* linked version of tar, mkswap, mke2fs, and fdisk).
BH> > 
BH> > You have to be sure that the backup is relative (which is what tar will
BH> > do by default).  You install a replacement drive.  Boot you boot/rescue
BH> > floppy set.  Typically set up to run in single user mode with a root
BH> > bash prompt.  You use fdisk (on the floppy) to set up the partitions,
BH> > use mkswap to initialize your swap partition and use swapon to connect
BH> > it up (this is optional, but not a bad idea). Then use mke2fs to format
BH> > the file systems, mount the root under /mnt (or a sub-directory there or
BH> > under /tmp or someplace), make the mount points for the other
BH> > filesystems and mount them.  Now you fire up tar:
BH> > 
BH> > tar xvf /dev/st0 -C /mnt
BH> > 
BH> > Adjust the -C parameter to match where the new disk was mounted.
BH> > 
BH> > Reboot with a boot floppy into single user mode (root == new hard disk
BH> > root).
BH> > 
BH> > Run lilo to restore the MBR and presto! restore complete.
BH> > 
BH> > Note: many new systems are being shipped with Zip drives.  It should be
BH> > quite easy (given a whole 100 or 250 meg) to 'install' a mini working
BH> > Linux system on a a Zip cart.  There might be issues as to whether you
BH> > can boot directly from the Zip cart (BIOS stupidity) , but you can
BH> > always create a 'normal' boot floppy and specifiy root=/dev/<zip drive
BH> > root partition>. Yes, fdisk is quite happy to re-partition a Zip drive
BH> > and mke2fs is also quite happy to make an Ext2 file sustem (or several
BH> > Ext2 file sustems) on a floppy.  I've not tried it, but I expect that
BH> > mkswap can make a swap partition there too.  It *should* be possible to
BH> > even create a boot floppy that loads the ppa driver, so you can do this
BH> > with a parallel port Zip drive.
BH> > 
BH> > BH> 
BH> > BH> --
BH> > BH> Posted via CNET Help.com
BH> > BH> http://www.help.com/
BH> > 
BH> BH>                                                                        
BH>                
BH> > 
BH> > 
BH> > 
BH> > 
BH> > 
BH> > 
BH> >                                                          
BH> > -- 
BH> >                                      \/
BH> > Robert Heller                        ||InterNet:   [EMAIL PROTECTED]
BH> > http://vis-www.cs.umass.edu/~heller  ||            [EMAIL PROTECTED]
BH> > http://www.deepsoft.com              /\FidoNet:    1:321/153
BH> 
BH> 
BH> --
BH> Posted via CNET Help.com
BH> http://www.help.com/
BH>                                                                           






                        
-- 
                                     \/
Robert Heller                        ||InterNet:   [EMAIL PROTECTED]
http://vis-www.cs.umass.edu/~heller  ||            [EMAIL PROTECTED]
http://www.deepsoft.com              /\FidoNet:    1:321/153

------------------------------

From: [EMAIL PROTECTED] (Carlos)
Crossposted-To: comp.os.linux.hardware
Subject: Re: Using CDRW as tar-like device
Date: 28 Jun 2000 19:05:07 -0500


A rlated question:  I once tried recording a couple of sessions on a CDR.
I tried several options on cdrecord and in all cases after recording the
second session (both sessions were iso files) the disk became unusable...

How can this be done and how does one access the different sessions
afterwards?

Carlos
carlos1w @ excite . com (disregard e-mail in header)


In article <[EMAIL PROTECTED]>,
Jim McDonald  <[EMAIL PROTECTED]> wrote:
>
>
>Christopher Wong wrote:
>> 
>> I wonder if it is possible to use a CD RW driver without the
>> make-a-whole-file-system step. I would like to append stuff onto a
>> recordable CD, but cdrecord does not seem to make this easy. Why can't
>> I just use "tar" or something similar and dump it onto a CD? There
>> does not seem to be an easy way to get "low-level" type of access. As
>> I understand it, one can only add some 40 or so sessions on a
>> multisession CD due to the overhead involved. There is also no
>> documentation that I can find on using cdrecord's packet writing mode.
>> 
>> Can anyone help? Thanks in advance.
>> 
>
>cdrecord has a packet writing mode?
>See http://sourceforge.net/project/?group_id=7091, but I'm pretty sure
>packet writing is only supported in late 2.3 and 2.4-test kernels.
>
>-- 
>Jim McDonald
>htttp://www.stanford.edu/~mcduck



------------------------------

From: Bob Martin <[EMAIL PROTECTED]>
Crossposted-To: alt.os.linux
Subject: Re: gcc --version
Date: Thu, 29 Jun 2000 00:17:50 +0000

[EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> How come gcc that comes with RH6.2 is "egcs-2.91.66", while an older
> distro, Mandrake7.0 comes with "gcc-2.95" ?
> (I remember that when I was using Mandrake7.0, RH6.2 wasn't out yet)
> 

distributions don't necessarily use the same revisions of software. some
are more conservative about upgrading, slackware kept libc5 long after
most others had gone to libc6. Mandrake tends to use the newest
available.
-- 

Bob Martin

------------------------------

From: Raul Montoliu =?iso-8859-1?Q?Col=E1s?= <[EMAIL PROTECTED]>
Subject: printer problem
Date: Tue, 27 Jun 2000 16:00:15 +0200

Hi!

I use this filter to print a file, the problem is when i want to print
a plain text (like a C source code) , the title of the document printted
is
ps.tmp.number.number and not the name of the file.

I understand why appears the name ps.tmp.... (a2p2 $f),

I want the title of the document will be the name of the file,

any suggestion?

Next the code of y filter:

#!/bin/bash

PATH=$PATH:/usr/local/bin

if [ ! "$1" ]
then
  tmp=ps.tmp.$$
  cat >$tmp
  f=$tmp
else
  f=$1
fi

linea="`head -n 1 $f`"
echo "@PJL SET DUPLEX=OFF" > ps.tmp.$$.$$
if echo "$linea" | grep -q "%\!PS-Adobe-"
then
  cat $f >> ps.tmp.$$.$$
else
  a2ps -1 $f --output=- >> ps.tmp.$$.$$
fi
cat ps.tmp.$$.$$
rm -f $tmp ps.tmp.$$.$$  

Thanks in advance!

------------------------------

From: Craig Jones <[EMAIL PROTECTED]>
Subject: Images to mpeg...
Date: Thu, 29 Jun 2000 00:13:55 GMT

I was just wondering if there were any Unix utilities that would convert
a series of data files (jpeg, bmp, dat, whatever) into an mpeg file?

Thanks,

Craig.


============================================
Craig Jones
[EMAIL PROTECTED]


Sent via Deja.com http://www.deja.com/
Before you buy.

------------------------------

From: Uwe Brauer <[EMAIL PROTECTED]>
Crossposted-To: comp.os.unix.misc,comp.unix.questions,comp.unix.shell
Subject: Re: tool for joining various (text) files, editing and splitting them
Date: 27 Jun 2000 16:22:13 +0000

[EMAIL PROTECTED] (Kai Gro�johann) writes:


> 
> What kinds of editing do you want to do?
> 
> And what do you mean by splitting?  Do you want to split using some
> criterion, or do you want to split into the same files you had
> originally?
> 
> Using Emacs, it might be possible to write some Lisp which does this.
> Hm.  You'd have to assign a text property giving the name the file
> came from, and then when saving the buffer, you'd have to go through
> all the files and save each region.  Hm.  Yes, that could work.
> 
> kai
> -- 

I guess with Lisp it would be complicated and slow. Let me describe
the example I have in mind:
I have 2 directories with each three files:

dir1:
  test1.1
  test1.2
  test1.3
dir2:
  test2.1
  test2.2
  test2.3

Now I join them getting and in the joining process marks are set to
distinguish the end and the beginning of each file, say the marks are
simply: /home/user/name_of_dir/name_of_file
/home/user/dir1/test1.1
this is the content of test 1.1
/home/user/dir1/test1.2
this is  content of test 1.2
/home/user/dir2/test1.3
this is  content of test 1.3
/home/user/dir1/test2.1
this is  content of test 2.1
/home/user/dir1/test2.2
this is content of  test 2.2
/home/user/dir1/test2.3
this is  content of test 2.3


Then I edit the whole file

/home/user/dir1/test1.1
this is the content of test 1.1
/home/user/dir1/test1.2
this is  content of test 1.2 CHANGE here
/home/user/dir2/test1.3
this is  content of test 1.3
/home/user/dir1/test2.1
this is  content of test 2.1
/home/user/dir1/test2.2
this is content of  test 2.2
/home/user/dir1/test2.3 CHANGE here
this is  content of test 2.3

Then the will be separated again.
In fact a have a small shell script who does this but I thought there
may exist some tools already written in say perl or so, but it seems
not so.

Uwe Brauer 

------------------------------

From: [EMAIL PROTECTED] (Bill Cripe)
Subject: File locking and file permissions
Date: Thu, 29 Jun 2000 00:21:29 GMT

I'm not a C programmer so it will be a great help to me if someone
can answer this question. I recently received the following from one
of the programmers where I work:

   unfortunately, linux does not support true file locking, as best I
   can tell. I don't know about the HPUX or the Sun. If you know of a
   way, tell me.

No file locking? Is this possible?
   Currently this programmer is using chmod to prevent other users
and processes from writing to a file, but the chmod fails if the file
is not owned by the user trying to lock it. This encourages users to
all log in as a single user to run this program (uggg!). All in all
it just plain doesn't work right.
   On a machine with the users umask set to 007 and good group
permissions throughout (i.e. directories are 770 and files are 660),
there's just got to be a way for a process owned by "A" to lock a
file owned by "B" while it writes and release it when it's done. Isn't
this exactly the purpose of "flock"? Or if not flock, then something
else more or less as direct?

Bill Cripe

------------------------------

From: "news.compuserve.com" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.networking,comp.os.linux.setup
Subject: Can't compile RTL8139.c; PAGE_OFFSET_RAW error
Date: Wed, 28 Jun 2000 20:20:58 -0400

    I'm trying to compile the rtl8139.c code for an SMC1211TX card, but I
can't get it to compile.  Here is a transcript of the compile session:

==========BEGIN TRANSCRIPT==========
[root@linux temp]# gcc -DMODULE -Wall -Wstrict-prototypes -O6 -c rtl8139.c
In file included from /usr/include/linux/capability.h:13,
                 from /usr/include/linux/binfmts.h:5,
                 from /usr/include/linux/sched.h:8,
                 from /usr/include/linux/mm.h:4,
                 from /usr/include/linux/slab.h:14,
                 from /usr/include/linux/malloc.h:4,
                 from rtl8139.c:103:
/usr/include/linux/fs.h:813: redefinition of `mark_buffer_highprio'
/usr/include/linux/fs.h:799: `mark_buffer_highprio' previously defined here
/usr/include/linux/fs.h:818: redefinition of `mark_buffer_lowprio'
/usr/include/linux/fs.h:804: `mark_buffer_lowprio' previously defined here
/usr/include/linux/fs.h:827: redefinition of `buffer_lowprio'
/usr/include/linux/fs.h:274: `buffer_lowprio' previously defined here
/usr/include/linux/fs.h:863: redefinition of `mark_buffer_dirty_lowprio'
/usr/include/linux/fs.h:846: `mark_buffer_dirty_lowprio' previously defined
here
/usr/include/asm/pgtable.h: In function `get_pgd_slow':
In file included from /usr/include/linux/vmalloc.h:7,
                 from /usr/include/asm/io.h:101,
                 from rtl8139.c:111:
/usr/include/asm/pgtable.h:408: `PAGE_OFFSET_RAW' undeclared (first use in
this function)
/usr/include/asm/pgtable.h:408: (Each undeclared identifier is reported only
once
/usr/include/asm/pgtable.h:408: for each function it appears in.)
/usr/include/asm/pgtable.h: In function `pte_alloc_kernel':
/usr/include/asm/pgtable.h:497: `PAGE_OFFSET_RAW' undeclared (first use in
this function)
/usr/include/asm/pgtable.h:505: warning: control reaches end of non-void
function
/usr/include/asm/pgtable.h: In function `pte_alloc':
/usr/include/asm/pgtable.h:515: `PAGE_OFFSET_RAW' undeclared (first use in
this function)
/usr/include/asm/io.h: In function `virt_to_phys':
In file included from rtl8139.c:111:
/usr/include/asm/io.h:112: `PAGE_OFFSET_RAW' undeclared (first use in this
function)
/usr/include/asm/io.h:113: warning: control reaches end of non-void function
/usr/include/asm/io.h: In function `phys_to_virt':
/usr/include/asm/io.h:117: `PAGE_OFFSET_RAW' undeclared (first use in this
function)
/usr/include/asm/io.h:118: warning: control reaches end of non-void function
/usr/include/asm/io.h: In function `check_signature':
/usr/include/asm/io.h:175: `PAGE_OFFSET_RAW' undeclared (first use in this
function)
==========END TRANSCRIPT==========

    Can anybody explain the source, and more importantly, the solution to
this problem?  Links to sites on the Web are just fine.  For the record, I
am running an install of Red Hat 6.0, with a kernel version of 2.2.5-15.  Is
this important?  Do I need to update my kernel?  I searched on Deja for the
better part of an hour, but I couldn't find a message that came close to
describing my problem.  TIA...

    Amiri Jones



------------------------------

From: [EMAIL PROTECTED] (Dances With Crows)
Subject: Re: Images to mpeg...
Date: 28 Jun 2000 20:35:38 EDT
Reply-To: [EMAIL PROTECTED]

On Thu, 29 Jun 2000 00:13:55 GMT, Craig Jones 
<<8je4bm$754$[EMAIL PROTECTED]>> shouted forth into the ether:
>I was just wondering if there were any Unix utilities that would convert
>a series of data files (jpeg, bmp, dat, whatever) into an mpeg file?

The Berkeley mpeg_encode could be what you're looking for, but it doesn't
support adding an audio track.  Seems to work OK, but it's not all that
fast especially with the quality settings cranked high.  I believe there's
another program that can make (non-Sorenson) Quicktime movies with sound
but I forget where it's located... "Heroine Linux" was prominently
featured on the site though.  Check http://freshmeat.net/ for mpeg_encode
and http://google.com/ for the Heroine site.

-- 
Matt G / Dances With Crows      /\    "Man could not stare too long at the face
\----[this space for rent]-----/  \   of the Computer or her children and still
 \There is no Darkness in Eternity \  remain as Man." --David Zindell "So did
But only Light too dim for us to see\ they become Gods, or Usenetters?" --/me

------------------------------

From: [EMAIL PROTECTED] (Dances With Crows)
Crossposted-To: comp.os.linux.hardware
Subject: Re: Using CDRW as tar-like device
Date: 28 Jun 2000 20:41:45 EDT
Reply-To: [EMAIL PROTECTED]

On 28 Jun 2000 19:05:07 -0500, Carlos 
<<8je3rj$ti8$[EMAIL PROTECTED]>> shouted forth into the ether:
>
>A rlated question:  I once tried recording a couple of sessions on a CDR.
>I tried several options on cdrecord and in all cases after recording the
>second session (both sessions were iso files) the disk became unusable...
>
>How can this be done and how does one access the different sessions
>afterwards?

It's in the HOWTO.  Read it--
http://linuxdoc.org/HOWTO/CD-Writing-HOWTO.html

Basically, you'd do:
  mkisofs -r -J /path/to/data | cdrecord -v -multi -
for the first session, then
TRACK=`cdrecord -msinfo`
  mkisofs -r -J -C $TRACK -M /dev/scd0 /path/to/more/data | cdrecord -v
-multi -

Repeat as needed for more sessions, leaving the -multi off the final
session on the disc.  Accessing a multisession CD should be end-user
transparent as all the sessions should be available when you mount the CD
normally.  You can pass options to mount, though, to mount only one
specific session if that's what you're looking for.  man mount.


-- 
Matt G / Dances With Crows      /\    "Man could not stare too long at the face
\----[this space for rent]-----/  \   of the Computer or her children and still
 \There is no Darkness in Eternity \  remain as Man." --David Zindell "So did
But only Light too dim for us to see\ they become Gods, or Usenetters?" --/me

------------------------------

Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED] (Rod Smith)
Subject: Re: Need clarification:  what really is 'MBR' and what is 'BOOT SECTOR'?
Crossposted-To: microsoft.public.windowsnt.misc,linux.redhat.misc
Date: Thu, 29 Jun 2000 00:45:42 GMT

In article <[EMAIL PROTECTED]>,
        Bruce Merry <[EMAIL PROTECTED]> writes:
> 
> As I understand it, every primary partition has a boot section, which
> are the first 512 bytes of that partition (an extended partition is a
> type of primary partition, although I don't think MS OS's will let you
> put anything in its boot sector.

Logical partitions also contain boot sectors, although many OSs
(including all those available from Microsoft) can't boot from a logical
partition. Some OSs, though, can, including Linux, OS/2, and BeOS.

(Note that the presence of a boot sector doesn't necessarily mean that
the partition is bootable; the boot sector is just the first sector of
the partition, which has special meaning during the boot process *IF*
the partition is bootable. If the partition is not bootable, the boot
sector may still contain vital information, but that's
filesystem-dependant stuff.)

> The MBR is the master boot record and
> this is the first 512 bytes of the entire disk. It contains the first
> stage boot up code and I think also the partition table.

Correct.

> At this point I'm not too sure but what I think happens is that with a
> default MBR, the BIOS will copy the MBR into memory on startup and the
> code in the MBR then loads the boot sector from the first active
> partition, which in turn loads the OS in that partition.

Correct. This is what happens with the MBR and boot sector for something
like a default all-DOS or all-Windows 9x system.

> Alternately you
> might have a boot manager with some code in the MBR (I believe NT does
> this) to select which partition you want to boot.

NT's OS Loader is actually based in the boot sector of the partition,
not in the MBR. It also relies on files on a FAT or NTFS partition (at a
minimum its configuration file, but also possibly files that are
duplicates of other OSs' boot sectors). NT does, however, re-write the
MBR when you install it, so it'll wipe out MBR-based boot loaders. Other
boot loaders, such as Linux's LILO, can reside in the MBR (LILO can also
reside in a partition's boot sector).

-- 
Rod Smith, [EMAIL PROTECTED]
http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

------------------------------

Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED] (Rod Smith)
Subject: Re: Need clarification:  what really is 'MBR' and what is 'BOOT SECTOR'?
Crossposted-To: microsoft.public.windowsnt.misc,linux.redhat.misc
Date: Thu, 29 Jun 2000 00:49:51 GMT

In article <[EMAIL PROTECTED]>,
        [EMAIL PROTECTED] writes:
> 
> I not sure
> about BIOS copying MBR into memory though.  When the computer first
> boots up, it looks for the first sector at cylinder 0, side 0 -- where
> the first boot sector is located (called MBR).  This sector (MBR)
> contains a small code (IPL) that tells the computer how to boot.

In other words, the computer loads it into memory.

> Win95
> will replace this code, as does Win NT -- the program is responsible for
> displaying OS's to choose from if you upgrade to NT from previous
> versions of Windows, like LILO.

Although Win9x and NT both replace the MBR when they install, they don't
use them for OS selection purposes. NT's OS Loader is located in the NT
partition's boot sector. Why Microsoft feels compelled to have its OSs
overwrite the MBR on installation I do not know.

> If you, Mr. Root, still insist that Win95/NT does not modify the MBR,
> get a program that you know is going to modify the MBR, then install
> WinNT.  This should be evidence enough.

Evidence that the MBR is overwritten, yes. Evidence that the NT boot
loader is located there, no.

-- 
Rod Smith, [EMAIL PROTECTED]
http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

------------------------------

From: [EMAIL PROTECTED] (brian moore)
Subject: Re: File locking and file permissions
Date: 29 Jun 2000 00:53:16 GMT

On Thu, 29 Jun 2000 00:21:29 GMT, 
 Bill Cripe <[EMAIL PROTECTED]> wrote:
> I'm not a C programmer so it will be a great help to me if someone
> can answer this question. I recently received the following from one
> of the programmers where I work:
> 
>    unfortunately, linux does not support true file locking, as best I
>    can tell. I don't know about the HPUX or the Sun. If you know of a
>    way, tell me.
> 
> No file locking? Is this possible?
>    Currently this programmer is using chmod to prevent other users
> and processes from writing to a file, but the chmod fails if the file
> is not owned by the user trying to lock it. This encourages users to
> all log in as a single user to run this program (uggg!). All in all
> it just plain doesn't work right.
>    On a machine with the users umask set to 007 and good group
> permissions throughout (i.e. directories are 770 and files are 660),
> there's just got to be a way for a process owned by "A" to lock a
> file owned by "B" while it writes and release it when it's done. Isn't
> this exactly the purpose of "flock"? Or if not flock, then something
> else more or less as direct?

Unix doesn't have 'real' file locking.  It has 'advisory' locks of
various sorts, and so-called 'mandatory' locks.  Neither is -really-
mandatory (ie, even with mandatory locks, you can rm a locked file and
write a new file with the same name -- the directory permissions
control the permission to delete or rename a file, not the file or any
locks on it).

Yes, flock will lock a file: it's an advisory lock, though (ie, anyone
else wanting to access the file will need to use flock() to check to see
if they can do it without annoying another process -- they could just
skip that check and write to it anyway).

There is also the so-called 'mandatory' locks, done with the 'lockf' (or
fcntl) function.  These would stop 'most' programs from being naughty.
But note that others (such as an editor) may do something like the
following as part of their save:
   .  mv file file.bak
   .  write file
   .  (optionally rm the .bak)

Mandatory locks won't stop that, but would probably suffice in most
cases.

See /usr/src/linux/Documentations/mandatory.txt and locks.txt.

-- 
Brian Moore                       | Of course vi is God's editor.
      Sysadmin, C/Perl Hacker     | If He used Emacs, He'd still be waiting
      Usenet Vandal               |  for it to load on the seventh day.
      Netscum, Bane of Elves.

------------------------------

From: Alex <[EMAIL PROTECTED]>
Subject: @home port scanning
Date: Thu, 29 Jun 2000 00:30:06 GMT

Hi,
 my @home provider has been known to port scan machines once in a while to
make sure that no one is running things like web and ftp servers.
 I am curious to know if they port scan me, and if so, what port range did
they scan. Under linux, how can I find out these details ie. which logs may
I examine, use of the nmap program?
 Also, would it still be possible to run a mail server for myself in this
situation?
Thanks,
Alex

--
Posted via CNET Help.com
http://www.help.com/

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.misc) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Misc Digest
******************************

Reply via email to