Skip to content

Checking the double call to the system function in method MIns…#2

Open
fitorec wants to merge 1 commit intoantiX-Linux:masterfrom
fitorec:master
Open

Checking the double call to the system function in method MIns…#2
fitorec wants to merge 1 commit intoantiX-Linux:masterfrom
fitorec:master

Conversation

@fitorec
Copy link

@fitorec fitorec commented Apr 5, 2021

I Checked the end of the MInstall::makeLinuxPartition function and apparently on line 500 it is executed and it is checked that it is executed correctly, later if the partition matches with ext *, the command is modified and in my opinion that is when the command should be executed again. In the rest of the times we only execute the same command twice.

I tried to review the logic of this function a bit and the nesting level confused me a bit, on the other hand there are comparisons that apparently will never be fulfilled, for example:

if (strncmp(type, "xfs", 4) == 0) {
  // never run
}
if (strncmp(type, "jfs", 4) == 0) {
  // never run
}

I would like to refactor this function, adding some unified test, roughly I think we could eliminate said nesting and at the same time review the string comparisons with something like:

if (strncmp(type, "reiser4", 7) == 0) {
    // ..
} else if(strncmp(type, "ext3", 4) == 0) {
    // ..
} else if(strncmp(type, "ext2", 4) == 0) {
    // ..
} else if(strncmp(type, "btrfs", 5) == 0) {
    // ..
} else if(strncmp(type, "xfs", 3) == 0) {
    // ..
} else if(strncmp(type, "jfs", 3) == 0) {
    // ..
}
if (system(cmd.toUtf8()) == 0) {
    return true;
}
// error
return false;

@fitorec fitorec changed the title 👀 Checking the double call to the system function in method MIns… Checking the double call to the system function in method MIns… Apr 5, 2021
@anticapitalista
Copy link
Contributor

Thanks for your post. The development for the antiX and MX installer takes place here: https://github.com/gazelle-installer/gazelle-installer so post there if you wish. This one is very old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants