Strange error when calling Dir.exists

Hi guys, today when I was doing test after new updates on my software, I got this strange error:

Would you like to install these softwares ?[yes/no]y

<< [1 / 155] Installing @SystemBase-Main:SystemBase (Pass1) /0.2.0/

&#9632; Preparing installation for SystemBase

===============
Internal error
===============

/snap/crystal/2394/share/crystal/src/crystal/system/unix/file.cr:44:9 in 'info?'
/snap/crystal/2394/share/crystal/src/file.cr:198:5 in 'info?'
/snap/crystal/2394/share/crystal/src/file.cr:197:3 in 'info?'
/snap/crystal/2394/share/crystal/src/dir.cr:255:15 in 'exists?'
.ISM.task.cr:42:1 in 'recordInstallationInformation'
.ISM.task.cr:7462:65 in '__crystal_main'
/snap/crystal/2394/share/crystal/src/crystal/main.cr:118:5 in 'main_user_code'
/snap/crystal/2394/share/crystal/src/crystal/main.cr:104:7 in 'main'
/snap/crystal/2394/share/crystal/src/crystal/system/unix/main.cr:9:3 in 'main'
/lib/x86_64-linux-gnu/libc.so.6 in '??'
/lib/x86_64-linux-gnu/libc.so.6 in '__libc_start_main'
/home/ism/snap/crystal/common/.cache/crystal/crystal-run-.ISM.task.tmp in '_start'
???

ISM raised that error because the ran script did not call properly a system command or the system command itself need to be fix.

I inspected the code, and this occur in this function when I try to check Dir.exists.
But why ??? It’s weird no ?

def recordInstallationInformation : Tuple(UInt128, UInt128, UInt128, UInt128)
            directoryNumber = UInt128.new(0)
            symlinkNumber = UInt128.new(0)
            fileNumber = UInt128.new(0)
            totalSize = UInt128.new(0)

            filesList = Dir.glob(["#{builtSoftwareDirectoryPathNoChroot}/**/*"], match: :dot_files)

            filesList.each do |entry|

                finalDestination = "/#{entry.sub(builtSoftwareDirectoryPathNoChroot,"")}"

                if File.directory?(entry)
                    if !Dir.exists?(finalDestination)
                        directoryNumber += 1
                    end
                else
                    if File.symlink?(entry)
                        symlinkNumber += 1
                    else
                        fileNumber += 1
                        totalSize += File.size(entry)
                    end
                end

            end

            return directoryNumber, symlinkNumber, fileNumber, totalSize

            rescue error
                Ism.printSystemCallErrorNotification(error)
                Ism.exitProgram
        end

What’s the actual error? Is it actually blank, or is your printSystemCallErrorNotification method just not including error.message?

So as I suspected, the error occured because of permission issue.

But I am happy you raise this point, because now I understand better why the error messages wasn’t so helpful.

This is the function I use to print the error:

def printSystemCallErrorNotification(error : Exception)
            limit = ISM::Default::CommandLine::InternalErrorTitle.size

            separatorText = String.new

            (0..limit).each do |index|
                separatorText += "="
            end

            fullLog = (error.backtrace? ? error.backtrace.join("\n") : error.message)

            title = "#{ISM::Default::CommandLine::InternalErrorTitle.colorize(:red)}"
            separatorText = "#{separatorText.colorize(:red)}"
            errorText = "\n#{fullLog.colorize(Colorize::ColorRGB.new(255,100,100))}"
            help = "\n#{ISM::Default::CommandLine::SystemCallErrorNotificationHelp.colorize(:red)}"

            puts
            puts separatorText
            puts title
            puts separatorText
            puts errorText
            puts help

            rescue error
                printSystemCallErrorNotification(error)
                exitProgram
        end