Bug 530083

Summary: file -s is not able to detect swap signature on ppc
Product: [Fedora] Fedora Reporter: Daniel Novotny <dnovotny>
Component: fileAssignee: Daniel Novotny <dnovotny>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: dnovotny, mbroz
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 504417 Environment:
Last Closed: 2009-10-21 14:01:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Novotny 2009-10-21 13:47:34 UTC
+++ This bug was initially created as a clone of Bug #504417 +++

Description of problem:

file utility do not understant swap signature on PPC platform
(or maybe the problem is 4k vs 64k page size)

x86_64:
  # mkswap /dev/sdb
  Setting up swapspace version 1, size = 320072929 kB
  # file -s /dev/sdb
  /dev/sdb: Linux/i386 swap file (new style) 1 (4K pages) size 78142805 pages
  # rpm -q file
  file-4.17-15.el5_3.1.x86_64

ppc:
  # mkswap /dev/sdb
  Setting up swapspace version 1, size = 73407397 kB
  # file -s /dev/sdb
  /dev/sdb: data
  # rpm -q file
  file-4.17-15.el5_3.1.ppc

file utility should probably detect swap on all supported platforms.

--- Additional comment from dnovotny on 2009-10-09 10:08:49 EDT ---

the ppc swap is vastly different than the i386/x86_64 one: we will need a new magic

I created a ppc swapfile and will analyze this

--- Additional comment from dnovotny on 2009-10-09 10:14:29 EDT ---

Created an attachment (id=364252)
swap file created by dd-ing /dev/zero and mkswap(8)ing afterwards

an interesting thing:

[root@ibm-js20-02 ~]# dd if=/dev/zero of=swap.ppc bs=4k count=16
16+0 records in
16+0 records out
65536 bytes (66 kB) copied, 0.000857522 seconds, 76.4 MB/s
[root@ibm-js20-02 ~]# mkswap swap.ppc 
mkswap: error: swap area needs to be at least 655kB



so I created a larger file. the signature is quite long way down in the file:

[dnovotny@dhcp-0-118 file-testfiles]$ od -c swap.ppc
0000000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0002000  \0  \0  \0 001  \0  \0  \0  \v  \0  \0  \0  \0  \0  \0  \0  \0
0002020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0177760  \0  \0  \0  \0  \0  \0   S   W   A   P   S   P   A   C   E   2
0200000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
3100000

--- Additional comment from dnovotny on 2009-10-20 08:00:53 EDT ---

Created an attachment (id=365333)
a patch

adding new magic

Comment 1 Daniel Novotny 2009-10-21 14:01:23 UTC
fixed in rawhide: file-5.03-10.fc13