Access local file with a #

Hi,

How can I open a ROOT file with a # character in the path? Eg.

% ls -l art#/idpvm.root
-rw-r--r--. 1 adye zp 762012 May  3 05:19 art#/idpvm.root
% root
root [0] f = TFile::Open("art#/idpvm.root")
SysError in <TFile::ReadBuffer>: error reading from file art Is a directory
Error in <TFile::Init>: art failed to read the file type data.
(TFile *) nullptr

I guess this is a side-effect of the TArchiveFile functionality, but I can’t get that to work anyway:

% tar tvf art.tar idpvm.root
-rw-r--r-- usatlas3/usatlas 762012 2023-05-03 05:19 idpvm.root
% root
root [0] f = TFile::Open("art.tar#idpvm.root")
Error in <TFile::Init>: art.tar not a ROOT file
(TFile *) nullptr

Maybe that only works for files opened with the root protocol. If that’s the case, wouldn’t it be better if TFile::Open interpreted the path literally for local files?


Background: why do I have files with # in the path?

I am using AVFS to do something similar to TArchiveFile, but for more than just ROOT access. It’s a pity that ROOT access is the one thing that doesn’t work, because AVFS also uses # as an archive signifier.

I simplified the above examples to test without bothering with AVFS. What I actually want to do is: from the parent directory mounted with mountavfs, I tried to access the file as:

% ls -l art.tar#/idpvm.root
-rw-r--r--. 1 lhcb171 31152 762012 May  3 05:19 art.tar#/idpvm.root
% root
root [0] f = TFile::Open("art.tar#/idpvm.root")
Error in <TFile::Init>: art.tar not a ROOT file
(TFile *) nullptr

It’s much worse if I try to open the file from the command-line:

% root "art.tar#/idpvm.root"
root [0]
Processing art.tar...
In file included from input_line_14:1:
art.tar:1:1: error: cannot use dot operator on a type
... *** many many many more errors ***

I can work round it by symlinking art.tar# from another “directory” without # in the name, but that defeats much of the advantage of AVFS of being able to access any archive directly.

ROOT Version: 6.26/08
Platform: x86_64-centos7
Compiler: gcc11


I’m not sure we can handle that yet - @pcanal @jblomer ?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.