'Test that special /proc/ files are handled correctly.
/proc/ files have the property that they are non seekable from their end
(i.e. seeking them relative to the end is not supported). They also return
an st_size of 0. For example:
$ stat /proc/self/maps
File: \'/proc/self/maps\'
Size: 0   Blocks: 0   IO Block: 1024 regular empty file
$ head /proc/self/maps
00400000-00409000 r-xp 00000000 fc:01 9180740 /usr/bin/head
00608000-00609000 r--p 00008000 fc:01 9180740 /usr/bin/head
When we try to use the MultiGetFile flow, it deduplicates the files and
since it thinks the file has a zero size, the flow will not download the
file, and instead copy the zero size file into it.'

@unittest.skipUnless((platform.system() == 'Linux'), '/proc    only    exists    on    Linux')
def testMultiGetFileOfSpecialFiles(self):

    client_mock = action_mocks.MultiGetFileClientMock()
    zero_sized_filename = os.path.join(self.temp_dir, 'zero_size')
    with open(zero_sized_filename, 'wb') as fd:
        pass
    pathspec = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.OS, path=zero_sized_filename)
    for _ in flow_test_lib.TestFlowHelper(transfer.MultiGetFile.__name__, client_mock, token=self.token, file_size='1MiB', client_id=self.client_id, pathspecs=[pathspec]):
        pass
    pathspec = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.OS, path='/proc/self/environ')
    for _ in flow_test_lib.TestFlowHelper(transfer.MultiGetFile.__name__, client_mock, token=self.token, file_size=(1024 * 1024), client_id=self.client_id, pathspecs=[pathspec]):
        pass
    data = open(pathspec.last.path, 'rb').read()
    urn = pathspec.AFF4Path(self.client_id)
    fd = aff4.FACTORY.Open(urn, token=self.token)
    self.assertEqual(fd.size, len(data))
    self.assertMultiLineEqual(fd.read(len(data)), data)
