>Synopsis:      "sed -i" not renaming/moving temp-file
>Category:      user
>Environment:
        System      : OpenBSD 6.3
        Details     : OpenBSD 6.3 (GENERIC) #1: Sat Apr 21 13:57:54
CEST 2018
[email protected]:/usr/src/sys/arch/i386/compile/GENERIC

        Architecture: OpenBSD.i386
        Machine     : i386
>Description:

"sed -i.bak '/2/d;q' file.txt" leaves temp file instead of renaming.

>How-To-Repeat:

 $ mkdir sedbug
 $ cd sedbug
 $ jot 5 > file.txt
 $ sed -e '/2/d;q' file.txt # expected behavior: 1 line
 1
 $ sed -i.bak -e '/2/d;q' file.txt # edit it in-place
 $ ls
 file.txt sedpK7uniHbMN
 $ cat file.txt # still has original contents
 1
 2
 3
 4
 5
 $ cat sedpK7uniHbMN
 1

Expected results:

 the resulting temp-file (which contains the correct data) should be
moved back atop the original source file(s).

>Fix:

 unknown

dmesg:
OpenBSD 6.3 (GENERIC) #1: Sat Apr 21 13:57:54 CEST 2018
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III ("GenuineIntel" 686-class, 128KB L2 cache)
798 MHz cpu0:
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,SSE,PERF
real mem  = 326582272 (311MB) avail mem = 306700288 (292MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 02/06/02, BIOS32 rev. 0 @ 0xe8a10, SMBIOS
rev. 2.3 @ 0xeb8b0 (47 entries) bios0: vendor Insyde Software version
"Version 27.02" date 02/04/2002 bios0: Gateway, Inc. Solo 1200
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP BOOT DBGP
acpi0: wakeup devices LID_(S4) BAT0(S4) PCI0(S3) MODM(S3) CARD(S4)
USB0(S1) USB1(S1) LAN0(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiec0 at acpi0
acpipwrres0 at acpi0: PFAN, resource for FAN0
acpitz0 at acpi0: critical temperature is 89 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 model "QT07" serial SANYOQT07 type LiON oem
"SANYO" "PNP0C0B" at acpi0 not configured
acpivideo0 at acpi0: VGA0
bios0: ROM list: 0xc0000/0xc000 0xe0000/0x1800 0xe5000/0x1000!
0xea000/0x5000! cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
0:10:0: mem address conflict 0xc000000/0x1000
pchb0 at pci0 dev 0 function 0 "VIA VT8605 PCI" rev 0x00
viaagp0 at pchb0: v2
agp0 at viaagp0: aperture at 0xa0000000, size 0x10000000
ppb0 at pci0 dev 1 function 0 "VIA VT8605 AGP" rev 0x00
pci1 at ppb0 bus 1
1:0:0: mem address conflict 0xc0000/0x10000
vga1 at pci1 dev 0 function 0 "S3 Twister" rev 0x02
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
cbb0 at pci0 dev 10 function 0 "O2 Micro OZ69[17]2 CardBus" rev 0x00:
irq 10 cbb1 at pci0 dev 11 function 0 "TI PCI1410 CardBus" rev 0x01:
irq 9 pcib0 at pci0 dev 17 function 0 "VIA VT8231 ISA" rev 0x10
pciide0 at pci0 dev 17 function 1 "VIA VT82C571 IDE" rev 0x06:
ATA100, channel 0 configured to compatibility, channel 1 configured
to compatibility wd0 at pciide0 channel 0 drive 0: <FUJITSU
MHU2100AT> wd0: 16-sector PIO, LBA, 95396MB, 195371568 sectors
MHU2100AT> atapiscsi0 at pciide0 channel 0 drive 1
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <QSI, CD-ROM SCR-242, CHC7> ATAPI
5/cdrom removable wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
cd0(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 ignored (disabled)
uhci0 at pci0 dev 17 function 2 "VIA VT83C572 USB" rev 0x19: irq 9
uhci1 at pci0 dev 17 function 3 "VIA VT83C572 USB" rev 0x19: irq 9
viapm0 at pci0 dev 17 function 4 "VIA VT8231 PMG" rev 0x10: SMI
iic0 at viapm0
spdmem0 at iic0 addr 0x50: 256MB SDRAM non-parity PC133CL2
viapm0: HWM disabled
auvia0 at pci0 dev 17 function 5 "VIA VT82C686 AC97" rev 0x40: irq 10
ac97: codec id 0x43585429 (Conexant CX20468 rev 1)
ac97: codec features reserved, headphone, 18 bit DAC, 18 bit ADC, No
3D Stereo audio0 at auvia0
"VIA VT82C686 Modem" rev 0x20 at pci0 dev 17 function 6 not configured
vr0 at pci0 dev 18 function 0 "VIA RhineII-2" rev 0x51: irq 7,
address 00:e0:b8:37:e1:50 sqphy0 at vr0 phy 1: 84220 10/100 PHY, rev.
0 cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 2 device 0 cacheline 0x0, lattimer 0x40
pcmcia0 at cardslot0
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 2 device 0 cacheline 0x0, lattimer 0x20
pcmcia1 at cardslot1
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pms0: ALPS Glidepoint, version 0x7322
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 configuration 1 interface 0 "VIA UHCI root hub" rev
1.00/1.00 addr 1 usb1 at uhci1: USB revision 1.0
uhub1 at usb1 configuration 1 interface 0 "VIA UHCI root hub" rev
1.00/1.00 addr 1 vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
wi0 at pcmcia1 function 0 "Lucent Technologies, WaveLAN/IEEE, Version
01.01" port 0xa000/64 wi0: Firmware 8.10 variant 1, address
00:02:2d:69:f5:9a root on wd0a (9643cb28c07c0164.a) swap on wd0b dump
on wd0b fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec

usbdevs:
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
VIA(0x1106), rev 1.00 port 1 powered
 port 2 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
VIA(0x1106), rev 1.00 port 1 powered
 port 2 powered

Reply via email to