Giter VIP home page Giter VIP logo

Comments (4)

mwilck avatar mwilck commented on July 30, 2024

It's @doug-gilbert's decision, but I don't like this idea much.

Changing the default behavior of a tool that has existed for decades is dangerous. sg3_utils supports other OSes besides systemd-based Linux. There might be environments in which opening the device read-only would make the command fail (not sure about that).

Note that sg3_utils ships with its own set of SCSI udev rules, which replace systemd's native ones. These are used on openSUSE, for example, and they try to avoid doing I/O on the device. It would be interesting to figure out if the issue is also observed if the sg3_utils udev rule set is used.

from sg3_utils.

zhangyoufu avatar zhangyoufu commented on July 30, 2024

In Linux, scsi_cmd_allowed allows START_STOP command on read-only fds. How about sg_start defaults to read-only on Linux, and defaults to read-write on other OSes?

from sg3_utils.

mwilck avatar mwilck commented on July 30, 2024

I suggest you create a PR and let @doug-gilbert decide.

from sg3_utils.

zhangyoufu avatar zhangyoufu commented on July 30, 2024

I thought there are many more utilities from sg3_utils could open device in read-only mode rather than read-write mode under Linux. I tried that on sg_sat_identify as well. But upon reading sg3_utils source code, I found something like this:

                pr2serr("If %s is a sg device, need read+write "
                        "permissions, even to read it!\n", inf);

and

static int
sg_in_open(const char * fnp, struct flags_t * flagp, int bs, int bpt)
{
    int flags = O_RDWR;

These code pieces make me feel not confident about changing the default open flag from O_RDWR to O_RDONLY. It should work on normal SCSI disks, but may or may not work on SCSI generic devices or other SCSI device types.

Closing this issue as my proposed modification may cause breaking changes.

from sg3_utils.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.