Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TNetXNGFile::Open fails with double slash (//) in path #7159

Closed
bfonta opened this issue Feb 9, 2021 · 2 comments
Closed

TNetXNGFile::Open fails with double slash (//) in path #7159

bfonta opened this issue Feb 9, 2021 · 2 comments
Assignees
Labels
bug fixathon This issue can be tackled at a ROOT fixathon in:I/O

Comments

@bfonta
Copy link

bfonta commented Feb 9, 2021

Describe the bug

When passing a path containing a double slash (//) to TChain, the last characters are trimmed. The bug has been described here. This is error-prone.

Expected behavior

Even if ones does not want to automatically convert the double slash into a single slash in some scenarios, a warning should be expected. The behavior also goes against what any Linux user would expect.

To Reproduce

I took the example from the original bug report:

TChain* mychain = new TChain("DecayTree");
mychain->AddFile("root://eoslhcb.cern.ch//eos/lhcb/user/<letter>/<username>/test2//mytestfile.root")
(int) 1
mychain->GetEntries()
Error in <TNetXNGFile::Open>: [ERROR] Server responded with an error: [3011] Unable to open file /eos/lhcb/user/<letter>/<usern>; No such file or directory

Setup

  1. ROOT Version: 6.20/02
  2. OS: Linux, SLC7
  3. How you obtained ROOT: binary install
@bfonta bfonta added the bug label Feb 9, 2021
@github-actions github-actions bot added this to Needs triage in Triage Feb 9, 2021
@eguiraud eguiraud added the in:I/O label Feb 9, 2021
@eguiraud eguiraud removed this from Needs triage in Triage Feb 9, 2021
@vepadulano vepadulano added the fixathon This issue can be tackled at a ROOT fixathon label Feb 5, 2024
@dpiparo dpiparo assigned dpiparo and unassigned Axel-Naumann Feb 13, 2024
@vepadulano
Copy link
Member

The following test works on my machine with the latest ROOT master

 #include <TFile.h>
#include <TChain.h>

#include <iostream>
#include <memory>

constexpr auto netFile = "root://eospublic.cern.ch//eos//root-eos//h1//dstarmb.root";

void testWithFile()
{
    std::unique_ptr<TFile> f{TFile::Open(netFile)};
    f->ls();
}

void testWithChain()
{
    TChain c{"h42"};
    c.Add(netFile);
    std::cout << "Number of entries in the chain: " << c.GetEntries() << "\n";
}

void testWithChainLocalName()
{
    TChain c;
    std::string fullpath{netFile};
    fullpath += "?#h42";
    c.Add(fullpath.c_str());
    std::cout << "Number of entries in the chain: " << c.GetEntries() << "\n";
}

int main()
{
    testWithFile();
    testWithChain();
    testWithChainLocalName();
}

With output

./repro.out
TNetXNGFile**		root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root	HBOOK file: dstarmb.hbook converted to ROOT
 TNetXNGFile*		root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root	HBOOK file: dstarmb.hbook converted to ROOT
  KEY: TTree	h42;1	dstar
Number of entries in the chain: 21920
Number of entries in the chain: 21920

I could not have access to the same file (under LHCb EOS), but I used another public EOS file and it should be equivalent. I will try to build an older version of ROOT and see if the problem was present at the time with the same file.

@vepadulano
Copy link
Member

I went as far back as ROOT 6.24 and the issue doesn't seem to be there

[vpadulan@lxplus717 ~]$./repro_7159.out
Warning in <UnknownClass::SetDisplay>: DISPLAY not set, setting it to vpadulan-macbook.dyndns6.cern.ch:0.0
TNetXNGFile**		root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root	HBOOK file: dstarmb.hbook converted to ROOT
 TNetXNGFile*		root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root	HBOOK file: dstarmb.hbook converted to ROOT
  KEY: TTree	h42;1	dstar
Number of entries in the chain: 21920
Number of entries in the chain: 21920
[vpadulan@lxplus717 ~]$root --version
ROOT Version: 6.24/00
Built for linuxx8664gcc on Apr 14 2021, 14:33:50
From tags/v6-24-00@v6-24-00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixathon This issue can be tackled at a ROOT fixathon in:I/O
Projects
Status: Done
Development

No branches or pull requests

5 participants