Differences between revisions 2 and 3
 ⇤ ← Revision 2 as of 2006-11-30 12:42:03 → Size: 3460 Editor: WillDye Comment: Added a simpler example ← Revision 3 as of 2006-11-30 13:39:09 → ⇥ Size: 3646 Editor: WillDye Comment: Deletions are marked like this. Additions are marked like this. Line 1: Line 1: The X-Y Problem, as it is sometimes called, is a logical fallacy which leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. It goes something like this: The X-Y Problem, as it is sometimes called, is a logical fallacy which leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. It often goes something like this: Line 4: Line 4: * User doesn't know how to do X, but thinks that he can fumble his way to a solution if he can just manage to do Y. * User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y. Line 6: Line 6: * User asks for help with Y. Which, of course, is totally wrong because he really wants help with X. And Y isn't actually going to help him do that. * User asks for help with Y. * Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve. * After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable substitute for X. Line 11: Line 13: Line 14: Line 17: Line 15: Line 19: Line 23: Line 28: Line 24: Line 30: Line 25: Line 32: Line 27: Line 35: Line 28: Line 37: Line 32: Line 42: Line 33: Line 44: Line 34: Line 46: Line 36: Line 49: Line 41: Line 55: Line 42: Line 57: Line 43: Line 59:

The X-Y Problem, as it is sometimes called, is a logical fallacy which leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. It often goes something like this:

• User wants to do X.
• User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
• User doesn't know how to do Y either.
• User asks for help with Y.
• Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
• After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable substitute for X.

Here's an example.

```<n00b> How can I echo the last three characters in a filename?

<feline> If they're in a variable:  echo \${foo: -3}
<feline> Why 3 characters?  What do you REALLY want?
<feline> Do you want the extension?

<n00b> Yes.

<feline> Then ASK FOR WHAT YOU WANT!
<feline> echo \${foo##*.}```

Another example:

```<lhunath> when starting a process from shell, the process inherits the gid of the shell - I'm looking to start a process with a different GID than my own, so I assumed I should first newgrp to the new group and then start the process - however, newgrp audio gives the following error when run as non-root: Cannot execute bash: No such file or directory
<lhunath> newgrp - audio works, however, but I can't use this in a shell script to start a certain process with a different GID since it spawns a subshell

<greycat> What are you *really* trying to do?

<lhunath> trying to start wine with GID of audio

<greycat> lhunath: well... daemontools includes a setuidgid program that could do it, but to run that, you have to start out as root, and then define a user account whose primary group has the GID you desire.
<greycat> I suspect what you *Really* want to do is "make wine's audio work".  Which means you probably want to add yourself to group 'audio' in /etc/group, and logout and back in.

<lhunath> grin, if only it were that easy. no, what I'm *really* trying to do is to get the rlimits that I set in pam for @audio to apply to the wineserver process so that it can use the sched_fifo to give audio threads a higher priority for games that request it. for wineserver to be able to use the rlimits, it needs to have a gid of the @audio that I defined in /etc/security/limits.conf

<greycat> You don't actually think that rlimits magically "pop up" when a process is invoked with a specific UID/GID, do you?
<greycat> rlimits are set within your *own* process and then handed down to your children when you fork/exec thme.
<greycat> Only specific things read pam.d config files -- things that are linked with libpam.

<lhunath> greycat: should if I define '@audio          -       rtprio          90' in /etc/security/limits.conf ;x

<greycat> lhunath: what process do you think reads that file?

<lhunath> pam
<lhunath> hrm.

<greycat> lhunath: and you think that "wine" is linked with libpam?
<greycat> you need to set the limits you want, *and then* run the program you want.
<greycat> it will inherit them.
<greycat> I do stuff like this all the time:    su --> ulimit -v whatever --> su - freenet --> start the Freenet node
<greycat> usually exec su - freenet, so that a raw root shell isn't left lying about if/when the freenet processes terminate

<lhunath> heh.

<goldfish> nice

<greycat> See, *this* is why I ask things like "What are you really trying to do"```

XyProblem (last edited 2020-05-03 01:54:18 by GreyCat)